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: 11390f,4c42ac518eba0bbe X-Google-Attributes: gid11390f,public X-Google-Thread: 1014db,4c42ac518eba0bbe X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,4c42ac518eba0bbe X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,4c42ac518eba0bbe X-Google-Attributes: gid103376,public From: kaz@helios.crest.nt.com (Kaz Kylheku) Subject: Re: Programming language vote - results Date: 1997/11/27 Message-ID: <65kj7l$9g5$1@helios.crest.nt.com>#1/1 X-Deja-AN: 293216950 References: <347440AD.35DF@idt.net> <65ih8m$pqt$1@news1.ucsd.edu> <880643794snz@genesis.demon.co.uk> <65keij$mkd$1@nerd.apk.net> Organization: A poorly-installed InterNetNews site Newsgroups: comp.lang.ada,comp.lang.apl,comp.lang.c,comp.lang.c++ Date: 1997-11-27T00:00:00+00:00 List-Id: In article <65keij$mkd$1@nerd.apk.net>, Jim Showalter wrote: >Lawrence Kirby (fred@genesis.demon.co.uk) wrote: >: In the last case it is not valid to even look at the value in the code. > ^^^^^^^^^^^^^^^^^^^^^^ > Excuse my ignorance, but I've noticed several references to the >above here lately and - although I don't think I lack imagination >- I must admit I haven't a clue as to what ill fortune may befall >a program that peeks at this ominous . > >Really, I simply know! :-) One day you may study computer architecture and find out that in some architectures, loading an invalid pointer into an address register will cause an exception. Incidentally, you need look no further than you 80x86 based PC to find such an architecture. In protected mode, if you load an illegal selector into a segment register, guess what happens. Any use of a pointer value may cause such an exception in the hardware. By imposing no requirements on what should happen, the standard makes it easier to implement C on such architectures. Essentially, it says ``Implementor, in the true spirit of C, you may simply translate the use of such an indeterminate value as usual and let all hell break loose''. :))) Of course, this sort of permissiveness means that the programmer has to know what he or she is doing, and must exercise care in order to create correct programs. Not having the patience or desire to learn the abstract language definition, most immature programmers opt out by relying instead their knowledge of how some particular hardware works---which is, after all, simpler and easier to understand than an abstract programming language description. Since their particular hardware does not trap on the use of illegal pointers, they wonder why the behavior is undefined when an indeterminate pointer value is used. Since their particular hardware allows any type to be aligned on any byte address, they wonder what alignment is and why they should every worry about it when casting pointers. Since on their particular hardware, pointers are all represented in the same way, they wonder why all the fuss about using (void **) as a generic pointer to pointer. Etc.