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: 1014db,dab7d920e4340f12 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,dab7d920e4340f12 X-Google-Attributes: gid103376,public From: mfeldman@seas.gwu.edu (Michael Feldman) Subject: Re: C is 'better' than Ada because... Date: 1996/06/23 Message-ID: <4qkio1$5pm@felix.seas.gwu.edu>#1/1 X-Deja-AN: 161747486 references: <4q8fbo$701@red.interact.net.au> <31CC75C1.5BF2AF6A@jinx.sckans.edu> organization: George Washington University newsgroups: comp.lang.c,comp.lang.ada Date: 1996-06-23T00:00:00+00:00 List-Id: In article , The Deviant wrote: > >But, the variable was initialized as > >char blah[5]; > >which means it goes out of its bouts as soon as it tries to access >blah[5], and thats when SIGSEGV, by definition, should occur. Ah, but one of the beauties of C is that (in general) it doesn;t do any range checking. Depending on how it really allocated your data, your program may, or may not, have gone out of your memory area, so no segmentation fault was raised. It's adventures like this that are _so_ challenging to the macho programmer types who just couldn't stand the compiler do wimpy stuff like put range checking in their code. Even nicer is an intermittent bug that _sometimes_ raises the seg fault, depending on just how far you rolled beyond the bounds of your array. I'd much prefer to write that code as A: array (1..5) of character; . . . for i in A'range loop do_something_with_A; end loop; Mike Feldman