Path: utzoo!attcan!uunet!lll-winken!lll-tis!oodis01!uplherc!sp7040!obie!wsccs!terry From: terry@wsccs.UUCP (Every system needs one) Newsgroups: comp.lang.c Subject: Re: Toy compilers (was Re: gotos) Summary: but Message-ID: <535@wsccs.UUCP> Date: 17 May 88 03:35:51 GMT References: <1988Apr8.183815.3187@utzoo.uucp> <449@goofy.megatest.UUCP> <1080@maynard.BSW.COM> Lines: 57 In article <1080@maynard.BSW.COM>, Larry Campbell writes: | In article <504@wsccs.UUCP> I wrote: | <> ... 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. Not all compilers do, however. | 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. You are neglecting the fact that "for(;;)" takes less code in "portable to lame compilers" fashion. When a lame compiler is all you have, better to write code that works on lame and un-lame (healed?) compilers alike. You also neglect the fact that the majority of software companies that have the same software on a *lot* of machines (we have code that runs on over 140 with only minor #ifdefs, usually relating to SysV vs. Berklix vs. VMS, etc.) doesn't necessarily own either the machines or the compilers. In addition, priveledges on porting machines are usually limited, so installing then removing a compiler is out of the question. Time, also, is generally limited to several hours, and if you can't port your 65000 lines of code relatively quickly (say 40 minutes at most), you won't have enought time to master a tape or remove your code. Note that this totally neglects the need to make tapes within that time frame if you are porting to something like a Northern Telecom system which can only read Northern Telecom tapes while purporting to be QIC-24 compatible. Generally, it is better to be portable to many compilers rather than having to buy many machines or have them sent to you, let alone the expense of having to buy a compiler that will compile your code because you're not portable to the compiler that comes with the machine and is supported by the manufacturer. | Terry Lambert UUCP: ...{ decvax, ihnp4 } ...utah-cs!century!terry | | @ Century Software OR: ...utah-cs!uplherc!sp7040!obie!wsccs!terry | | SLC, Utah | | These opinions are not my companies, but if you find them | | useful, send a $20.00 donation to Brisbane Australia... | | 'Admit it! You're just harrasing me because of the quote in my signature!' |