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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,98ad5b2a2cd88a53 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,98ad5b2a2cd88a53 X-Google-Attributes: gid103376,public From: Gautier.DeMontmollin@maths.unine.ch Subject: Re: Ada or C++ acting 'correctly' here? Date: 1999/02/27 Message-ID: #1/1 X-Deja-AN: 449356352 References: <7b8c7u$sj1@drn.newsguy.com> Organization: University of Neuchatel, Switzerland Newsgroups: comp.lang.ada,comp.lang.c++ Date: 1999-02-27T00:00:00+00:00 List-Id: > 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: (...) > { > cout<<(500000000*7); > return 0; > } (...) > begin > Put( 500000000*7 ); > end Test_Multi; (...) > Now. Which would you consider the correct language behaviour? > (same machine, Pentium pro, Linux. This could be a bright example of how a strong-typed language helps you finding errors already at compile time (here: a 32-bit overflow). If accepted by the compiler, such a bug, lost in a large program, could take days to locate! -- Gautier