for(;;) ? valid : bad programming

Associate
Joined
10 Feb 2004
Posts
198
Hey,

I'm a noobie to the c language, and wanted to get a general opinion on the following.

is......

for ( ; ; )

acceptable, or bad programming style??

cheers in advance
bill
 
Last edited:
thanks for all the responses, very informative. it seems like its acceptable to most.

to my mind though,

for ( ; ; )

and

while ( 1 )

must be poor programming style at the very least.

conveying programmer intention is surely best served with....

while ( TRUE )

anyway, question answered.

cheers
bill

ps talking more generally about programming style, anyone have any good sites or books that discuss it? I run a software department that is just moving over to C and would love to produce a "rules" book, but dont really know where to start!
 
As I say I'm a noob to C so bare with me. So is 1 (or non-zero presumably) actually defined as true? I thought I had read of some compilers reversing this, I may be wrong though.

The reason for not going to c++ is that its for embedded systems, its still quite difficult to get c++ compilers. There is almost never any problems getting a straight C compiler.

Bill
 
Mr Jack (and everyone else) thanks for the replies. most helpful.

I particularly like the info about zero and non-zero return/error codes, always easier learning things when you know a bit more detail about the whys and wherefores. All good stuff.

As for embedded c++, it is becoming more common, but still nowhere near ubiquitous. We use quite a few different platforms, so its useful to have code in as portable format as possible. C fits that bill nicely. Having said all that, we used to use assembler!!
 
Back
Top Bottom