Path: utzoo!mnetor!uunet!husc6!purdue!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Machine specific predefined names Message-ID: <10646@mimsy.UUCP> Date: 15 Mar 88 08:11:10 GMT References: <1988Feb17.115402.12739@light.uucp> <17033@watmath.waterloo.edu> <302@wsccs.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 59 In article <302@wsccs.UUCP> terry@wsccs.UUCP (terry) writes: >I don't believe everybody will rewrite their UNIX in ANSI C, anyway, so lets >all hold our breath, and it will go away, leaving only K&R and some idiots >blinking their eyes at the sudden light. This is, I think, naive. A number of vendors are fanatically tracking the dpANS even now. 4BSD may be slow to follow (as in `you will have to wait for 4.4BSD to have even a faint hope of seeing an ANS-conforming compiler' [well, you can try GNU CC in the interim]), and I believe some vendors will provide two flavours of C (to work around the botches[1] in the standard until everyone can change their code), but the standard looks very real. ----- [1] E.g., widening rules for unsigned (yes, I am going to harp on that one forever). ----- As an aside, terry asks us to run the following to see why, he believes, people need to write their own `printf' functions, spurning those in the supplied libraries: > #include > main() > { > printf( NULL); > } > >Some systems will core dump, some systems will do nothing, and others will >print the string '(NULL)' (my quotes). True. Some might even catch your bugs at compile time! If you do that, all bets are off, just as if you do *this*: main() { float f; int *p = (int *)&f; *p = 0x00008000; printf("%g\n", f); exit(0); } Run it on a Vax and you will get `Illegal instruction (core dumped)', because the bit pattern 0x00008000 is reserved and is an illegal float. Note that the line printf(NULL); contains two bugs. First, it should be printf((char *)NULL); and second, printf is not supposed to be passed (char *)NULL. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris