Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!njin!uupsi!sunic!lth.se!E89HSE@rigel.efd.lth.se From: e89hse@rigel.efd.lth.se Newsgroups: comp.lang.c Subject: Re: Pascal (was Re: for(;;) vs. while(1) is a draw) Message-ID: <00937A53.78217800@rigel.efd.lth.se> Date: 3 Jun 90 16:14:09 GMT References: <5879@buengc.BU.EDU> <1751@tkou02.enet.dec.com> <3104@goanna.cs.rmit.oz.au>,<3928@darkstar.ucsc.edu> Sender: newsuser@lth.se (LTH network news server) Reply-To: e89hse@rigel.efd.lth.se Organization: Lund Institute of Technology,Lund, Sweden Lines: 31 In article <3928@darkstar.ucsc.edu>, femto@ucscb.UCSC.EDU (71017000) writes: > >I have used the following for several years: > >#define HELL 666 >#define FROZEN -273 > >while (HELL != FROZEN) { > ... do whatever I think it would be better to write something like: #if HELL != FROZEN for(;;) /* or while(1) if you prefer */ ... do whatever #endif This has the advatge that lint (at least some lints) won't warn you for unreachable code. I also think, but this is a personal opinion, that it is clearer. Henrik Sandell ps. Concerning while(1) and for(;;). My old CP/m C-compiler (Digital Research) used to have the declaration: #define forever() for(;;) in portab.h. I agree that for(;;) is ugly, but somehow I don't think while(1) look good either.