B
Bob
Hi,
I have been trying to use some inventive alternative idioms for infinite
loops in my code, rather than the same old for(;
and while(1) - this
could be a nice amusing Easter-egg for any future maintenance
programmers!
One of my ideas was this:
unsigned u = SHRT_MAX << 2; // misleading initialization - tee hee!
while(++u>=0)
{
// loop
}
Unfortunately, the compiler gives a warning for this, which rather
spoils the fun... does the compiler have to give a diagnostic here, and
can anyone think of a way of using the same basic idea but without
generating a warning?
I have been trying to use some inventive alternative idioms for infinite
loops in my code, rather than the same old for(;
could be a nice amusing Easter-egg for any future maintenance
programmers!
One of my ideas was this:
unsigned u = SHRT_MAX << 2; // misleading initialization - tee hee!
while(++u>=0)
{
// loop
}
Unfortunately, the compiler gives a warning for this, which rather
spoils the fun... does the compiler have to give a diagnostic here, and
can anyone think of a way of using the same basic idea but without
generating a warning?