From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_20,INVALID_MSGID, LOTS_OF_MONEY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,9ac62ca34a465706 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,9ac62ca34a465706 X-Google-Attributes: gid103376,public From: N.Perry@massey.ac.nz (Nigel Perry) Subject: Re: on OO differnces between Ada95 and C++ Date: 1996/02/27 Message-ID: #1/1 X-Deja-AN: 141319955 references: <4gbq7q$g08@qualcomm.com> <3129F185.41C6@Rational.COM> <4gi413$qo1@druid.borland.com> <4gspen$ot0@hacgate2.hac.com> <4gt3ag$76m@druid.borland.com> organization: Dept of Computer Science, Massey University newsgroups: comp.lang.ada,comp.lang.c++ Date: 1996-02-27T00:00:00+00:00 List-Id: In article <4gt3ag$76m@druid.borland.com>, pete@borland.com (Pete Becker) wrote: >No, my original statement is correct: a program which contains multiple >definitions of the same class is not a valid C++ program because it violates >the one definition rule. That is exactly the case that the original message >so cavalierly. There aren't many compilers that enforce this rule, but it is >nevertheless a constraint on valid C++ programs. C++ Draft Standard: 3.2 One defintion rule, clause 8: No diagnostic is required for a violation of the ODR rule. Similarly, 3.5 Program and linkage, clause 9 ends: A violation of this rule on type identity does not require a diagnostic [also many other places in the Standard] What does this mean. Well Pete may be right (I haven't checked) that the code is "wrong", but "wrong" code does not require a diagnostic in C++. The opposite of a diagnostic is surely a succesful compile & link (but not necessarily a succesful execution!), so "wrong" code meets the Standard... My guess is that defining "private" as "public" to break encapsulation isn't forbidden by the Standard - if it was then it wouldn't be C/C++ would it? :-) Don't people use C/C++ so they *can* break the rules? If you want strict type checking etc. go use Ada 95, Haskell, SML, etc. etc. etc. Just my 2c's worth :-) -- Dr Nigel Perry Email: N.Perry@massey.ac.nz Department of Computer Science Tel: +64 6 350 4007 Massey University Fax: +64 6 350 5611 Attn. Dr N. Perry Palmerston North Ftp/Gopher: smis-asterix.massey.ac.nz New Zealand (Mac software/Research papers) The Cycle Helmet Law: New Zealand's Shame, Speeding before children :-( Prevention is better than padding!