Infinite loops

Davidsen davidsen at steinmetz.UUCP
Wed May 7 05:22:29 AEST 1986


In article <116 at cbmvax.cbmvax.cbm.UUCP> grr at cbmvax.UUCP (George Robbins) writes:
>In article <117 at brl-smoke.ARPA> gwyn at BRL.ARPA (VLD/VMB) writes:
>>
>>do ... while(1);
>>while(1) ...
>>for(;;) ...
>>
>>are all widely-used idioms for unconditional looping in C.
>>I personally prefer the latter, but the choice is just a
>>matter of taste.  Any reasonable compiler will generate
>>efficient code for all three constructs.
>
>#define loop for(;;)
>
>This is a clean way to do it, but be aware that there is no obvious stopping
>point, and soon C purists will soon be declaring that your code has been tainted
>by exposure to noxious influences from Algol 68 or worse...
>

You could change the definition(s) to:
  #define loop for(;;){
  #define endloop }

Or, as I have seen in a few programs:
  #define ever (;;)
-- 
	-bill davidsen

	seismo!rochester!steinmetz!--\
       /                               \
ihnp4!              unirot ------------->---> crdos1!davidsen
       \                               /
        chinet! ---------------------/        (davidsen at ge-crd.ARPA)

"Stupidity, like virtue, is its own reward"



More information about the Comp.lang.c mailing list