Path: utzoo!mnetor!uunet!husc6!maynard!campbell From: campbell@maynard.BSW.COM (Larry Campbell) Newsgroups: comp.lang.c Subject: Toy compilers (was Re: gotos) Message-ID: <1080@maynard.BSW.COM> Date: 3 May 88 02:24:06 GMT References: <1988Apr8.183815.3187@utzoo.uucp> <449@goofy.megatest.UUCP> <1988Apr24.012322.3951@utzoo.uucp> <504@wsccs.UUCP> Reply-To: campbell@maynard.UUCP (Larry Campbell) Organization: The Boston Software Works, Inc. Lines: 33 In article <504@wsccs.UUCP> terry@wsccs.UUCP (Every system needs one) writes: <> ... I happen to write code that uses <> <> for( ;;) { <> } <> <>instead of <> <> while( 1) { <> } <> <>too, as I need the best speed out of the hardware I can get and the 'for' <>avoids a test instruction being generated. Certainly, the 'while' is better <>at self-documenting, but it isn't the right tool for the job. For someone who believes in using the right tool for the job, you seem to have chosen a pathetically lame compiler. The compiler should generate the same code in both cases, since (1) is obviously a compile-time constant expression. It's penny-wise and pound-foolish to buy a toy compiler, and then feel compelled to write code like the above. In the long run, the maintenance and support costs you incur will vastly overshadow the few hundred dollars you might have saved by skimping on the compiler. P.S. - I just compiled a "while (1)" loop on my system, which has one of the wimpier C compilers around. It generated the right code (i.e., no test instructions, just a jump to the top of the loop). And this was without -O. -- Larry Campbell The Boston Software Works, Inc. Internet: campbell@maynard.bsw.com 120 Fulton Street, Boston MA 02109 uucp: {husc6,mirror,think}!maynard!campbell +1 617 367 6846