main without a return statement

P

pete

Keith said:
Or:

while (1) { ... }

(Let's not have a lengthy debate about which one is clearer, better,
and/or more idiomatic, ok?)

You've got to be kidding!!!

First of all:
for (;;) { ... } gives No warning on MY compiler.
(for one specific value of "me").
while(1) gives me a warning about a conditional test expression
being constant.

Second of all:
for (;;) { ... } is the K&R example for an endless loop.

Third of all:
It's a special rule in the language for endless loops.
for (;1;); /* compiles */
for (; ;); /* compiles */
while(1); /* compiles */
while( ); /* doesn't compile */
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top