comp.lang.ada
 help / color / mirror / Atom feed
* Ada or C++ acting 'correctly' here?
@ 1999-02-27  0:00 bill
  1999-02-27  0:00 ` Steve Doiel
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: bill @ 1999-02-27  0:00 UTC (permalink / raw)


Hello,

compare these 2 little programs, do same thing, one in C++
and one in Ada. The C++ program compiles Ok, but result is
negative, the Ada program refused to compile:


----------------------------
#include <iostream>
int main()
{
  cout<<(500000000*7);
  return 0;
}
-----------------------------
%g++ -Wall test_mult.cc
%./a.out
-794967296

(this is g++ 2.8.1)

----------------------------
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
procedure Test_Multi is
  begin
   Put( 500000000*7 );
  end Test_Multi;
-----------------------------
$gnatmake test_multi.adb
gcc -c test_multi.adb
test_multi.adb:6:18: value not in range of type "Standard.Integer"
test_multi.adb:6:18: static expression raises "Constraint_Error"
gnatmake: "test_multi.adb" compilation error


Now. Which would you consider the correct language behaviour?
(same machine, Pentium pro, Linux.

Bill.




^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~1999-03-18  0:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-27  0:00 Ada or C++ acting 'correctly' here? bill
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
     [not found]   ` <36e8e201.48455851@netnews.worldnet.att.net>
1999-03-18  0:00     ` bglbv
1999-02-27  0:00 ` Matthew Heaney
1999-02-27  0:00 ` Gautier.DeMontmollin
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   ` Pascal Obry
1999-03-02  0:00   ` Gautier.DeMontmollin
1999-03-02  0:00     ` kvisko
1999-03-02  0:00   ` SpamSpamSpam
1999-03-02  0:00   ` robert_dewar

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