comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@cygnus.stuttgart.netsurf.de>
Subject: Re: Ada or C++ acting 'correctly' here?
Date: 1999/02/28
Date: 1999-02-28T08:38:35+00:00	[thread overview]
Message-ID: <m3678mdit2.fsf@deneb.cygnus.stuttgart.netsurf.de> (raw)
In-Reply-To: 7baig1$mg1$1@nnrp1.dejanews.com

robert_dewar@my-dejanews.com writes:

> In article <36D85A54.2A0E6283@ibm.net>,
>   bijuthom@ibm.net wrote:
> > No. The C++ compiler is non-conforming. The C++ standard
> > says that if a constant expression cannot be represented
> > in the target type, the program is ill-formed. (Chapter
> > 5, paragraph 5.) A C++ compiler is required to issue a
> > diagnostic message while compiling an ill-formed
> > program. (It is *not* an undefined behaviour.)
> 
> Interesting, this is new to me, is this something that
> has been in informal C++ definitions from the start, or
> was it something added for the ISO standard?

In Stroustroup's `The C++ programming language', second edition (1991),
there is no distinction between compile-time and run-time evaluation.
Integer overflow (on both occasions) results in undefined behaviour.

> By the way, I still think this shows an advantage of
> Ada, one cannot imagine bumping into a non-conforming
> Ada 95 compiler that would not reject the Ada example
> here. I suspect the C++ situation is precisely an
> indication of the fact that C++ compilers are not
> yet generally fully conforming with the ISO standard.

This is really a problem.  Some vendors seem to be completely
uninterested in making their compiler conforming with the standard.
For example, one vendor's compiler has an option to enable the new
scoping rules on loop counter variables (which completely make sense
and are already widely used), but the header files provided by the same
vendor can't be used if that switch is turned on. :-/




  reply	other threads:[~1999-02-28  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-27  0:00 Ada or C++ acting 'correctly' here? bill
1999-02-27  0:00 ` Matthew Heaney
1999-02-27  0:00 ` Gautier.DeMontmollin
1999-02-27  0:00 ` Florian Weimer
     [not found]   ` <36e8e201.48455851@netnews.worldnet.att.net>
1999-03-18  0:00     ` bglbv
1999-02-27  0:00 ` Claudius Proculus
1999-02-27  0:00   ` Biju Thomas
1999-02-28  0:00     ` robert_dewar
1999-02-28  0:00       ` Florian Weimer [this message]
1999-03-01  0:00         ` dewar
1999-02-27  0:00 ` Steve Doiel
1999-02-28  0:00 ` William McKenzie
1999-03-01  0:00   ` fraser
1999-03-01  0:00   ` Hubert B. Keller
1999-02-28  0:00 ` robert_dewar
1999-03-02  0:00 ` Willliam V
1999-03-02  0:00   ` robert_dewar
1999-03-02  0:00   ` SpamSpamSpam
1999-03-02  0:00   ` Pascal Obry
1999-03-02  0:00   ` Gautier.DeMontmollin
1999-03-02  0:00     ` kvisko
replies disabled

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