comp.lang.ada
 help / color / mirror / Atom feed
From: N.Perry@massey.ac.nz (Nigel Perry)
Subject: Re: on OO differnces between Ada95 and C++
Date: 1996/02/27
Date: 1996-02-27T00:00:00+00:00	[thread overview]
Message-ID: <N.Perry-2702962052330001@fims-ara1.massey.ac.nz> (raw)
In-Reply-To: 4gt3ag$76m@druid.borland.com

In article <4gt3ag$76m@druid.borland.com>, pete@borland.com (Pete Becker) wrote:

<snip>
>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 
<snip>
>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!




  reply	other threads:[~1996-02-27  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-20  0:00 on OO differnces between Ada95 and C++ Nasser Abbasi
1996-02-20  0:00 ` Jerome Desquilbet
1996-02-21  0:00   ` Robert Dewar
1996-02-22  0:00     ` Jerome Desquilbet
1996-02-24  0:00       ` Robert Dewar
1996-02-22  0:00   ` Pete Becker
1996-02-23  0:00     ` Jerome Desquilbet
1996-02-26  0:00     ` Darren C Davenport
1996-02-26  0:00       ` Pete Becker
1996-02-27  0:00         ` Nigel Perry [this message]
1996-02-20  0:00 ` Norman H. Cohen
1996-02-21  0:00   ` Mark A Biggar
1996-02-22  0:00     ` Norman H. Cohen
1996-02-27  0:00   ` Adam Morris
1996-02-20  0:00 ` Robert I. Eachus
1996-02-21  0:00 ` Darren C Davenport
1996-02-21  0:00 ` John English
1996-02-22  0:00   ` Gene Ouye
1996-02-26  0:00     ` John English
1996-02-22  0:00   ` Nasser Abbasi
1996-02-26  0:00     ` John English
1996-02-27  0:00       ` Dale Stanbrough
1996-02-21  0:00 ` Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1996-02-21  0:00 Christian Jaensch, FRG
1996-02-26  0:00 Simon Johnston
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox