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,1042f393323e22da X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,1042f393323e22da X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,1042f393323e22da X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Any research putting c above ada? Date: 1997/04/17 Message-ID: #1/1 X-Deja-AN: 235636472 Distribution: world References: <5ih6i9$oct$1@waldorf.csc.calpoly.edu> Organization: PSI Public Usenet Link Newsgroups: comp.lang.c++,comp.lang.c,comp.lang.ada Date: 1997-04-17T00:00:00+00:00 List-Id: In article <3355739E.7B24@pratique.fr> Valentin Bonnard writes: > > For example, consider that in C++, it is _undefined behavior_ to fail > > to return a value from a function that returns some non-void type. > > This could easily have been turned into a _constraint violation_. > > It's nearly the same from std point of view: > > - in Ada, the std say raise in case of such error; compilers give > way to disable the test and you get undefined behaviour > > - in C/C++, thestd say the behaviour is undefined in case of such > error; the compiler is free to optimise the code by guessing this > won't appen or generate a runtime check and show a nice error > message in case of exception > > So it's a quality of implementation problem more than a std problem. I don't see how this follows. In the Ada case the _programmer_ has to intentionally and explicitly turn off the check. Actually, I'm not sure you can turn this check off (11.5 doesn't actually call this case out). In the C/C++ case you're stuck even if you would like such things to be caught and brought to your attention. To put it another way: in the Ada case the implementation _must_ support the checks and is free to support some form of check suppression if the implementors wish. In the C/C++ case, the implementation is not required to do anything about such cases. /Jon -- Jon Anthony Organon Motives, Inc. Belmont, MA 02178 617.484.3383 jsa@organon.com