Newsgroups: comp.arch Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Shifting question Message-ID: <1988Jul23.231300.22872@utzoo.uucp> Organization: U of Toronto Zoology References: <705@bnr-rsc.UUCP> <11556@steinmetz.ge.com> <1988Jul19.173807.6604@utzoo.uucp> <11606@steinmetz.ge.com> Date: Sat, 23 Jul 88 23:13:00 GMT In article <11606@steinmetz.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes: > The rules may say anything is undefined, but that doesn't make it a >good idea. At one time early in standards process, the question of >having sizes known to the preprocessor was discussed. At that time my >recollection is that sizeof was not to be allowed in a preprocessor >constant expression, although reading the standard certainly seems to >say it is at this time. You have an out-of-date draft, I believe. The second-public-comment draft (I haven't seen the third yet) explicitly forbids sizeof in this context. >... If C is ever going to be a portable general purpose >language rather than a toy for hackers, programmers should not have to >guess that two shifts of 10 don't give the same result as one shift of >20 (or whatever the sizes may be), or any of the other non-intuitive >things which happen in the name of speed. To slightly misquote DMR: "if you want Pascal, you know where to find it". C is already a portable general purpose language, one which specializes in speed rather than in coddling novice C programmers. Consider an analogy. Effective and safe use of a fully-equipped vertical milling machine requires learning and practicing page after page of procedures and precautions; it is *not* something you can learn in five minutes, and the machine can -- literally -- kill you if you get sloppy. Building it out of soft plastic would make it much safer. However, for a real machining job, I want the metal one, despite its complex procedures and the very real dangers incurred in the name of rapid and precise machining. >... The default should be to have the source code work as written. It already does. When you write >> in a C program, that is the C >> operator you are writing, not some abstract mathematical version with different properties. -- Anyone who buys Wisconsin cheese is| Henry Spencer at U of Toronto Zoology a traitor to mankind. --Pournelle |uunet!mnetor!utzoo! henry @zoo.toronto.edu