From: Florian Weimer <fw@cygnus.stuttgart.netsurf.de>
Subject: Re: Ada or C++ acting 'correctly' here?
Date: 1999/02/27
Date: 1999-02-27T15:15:51+00:00 [thread overview]
Message-ID: <m3ogmfg9ne.fsf@deneb.cygnus.stuttgart.netsurf.de> (raw)
In-Reply-To: 7b8c7u$sj1@drn.newsguy.com
bill@mooner writes:
> ----------------------------
> #include <iostream>
> int main()
> {
> cout<<(500000000*7);
> return 0;
> }
> -----------------------------
Quotation from ISO/IEC 14882:1998(E), Chapter 5 (Expressions):
| 5 If during the evaluation of an expression, the result is not
| mathematically defined or not in the range of representable values
| for its type, the behavior is undefined, unless such an expression is
| a constant expression (5.19), in which case the program is ill-formed.
The standard doesn't mention that no diagnonstic is required, so
conforming implementations have to refuse to compile this program.
> ----------------------------
> with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
> procedure Test_Multi is
> begin
> Put( 500000000*7 );
> end Test_Multi;
> -----------------------------
Quotation from ISO/IEC 8652:1995(E), Section 4.9 (Static Expressions
and Static Subtypes):
| 33 A static expression is evaluated at compile time except when it is
| part of the right operand of a static short-circuit control form whose
| value is determined by its left operand. This evaluation is performed
| exactly, without performing Overflow_Checks. For a static expression
| that is evaluated:
|
| 34 The expression is illegal if its evaluation fails a
| language-defined check other than Overflow_Check.
Again, conforming compilers must refuse to compile this program.
(BTW: It's pretty pointless to compare languages this way, isn't it?)
next prev parent reply other threads:[~1999-02-27 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 ` Gautier.DeMontmollin
1999-02-27 0:00 ` Matthew Heaney
1999-02-27 0:00 ` Steve Doiel
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
1999-03-01 0:00 ` dewar
1999-02-27 0:00 ` Florian Weimer [this message]
[not found] ` <36e8e201.48455851@netnews.worldnet.att.net>
1999-03-18 0:00 ` bglbv
1999-02-28 0:00 ` robert_dewar
1999-02-28 0:00 ` William McKenzie
1999-03-01 0:00 ` Hubert B. Keller
1999-03-01 0:00 ` fraser
1999-03-02 0:00 ` Willliam V
1999-03-02 0:00 ` Pascal Obry
1999-03-02 0:00 ` Gautier.DeMontmollin
1999-03-02 0:00 ` kvisko
1999-03-02 0:00 ` robert_dewar
1999-03-02 0:00 ` SpamSpamSpam
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox