[Zlib-devel] infnew-5b available for testing

Mark Adler mark.adler at quest.jpl.nasa.gov
Fri Jan 3 12:16:00 EST 2003


On Friday, January 3, 2003, at 05:33  AM, Glenn Randers-Pehrson wrote:
> The MIPS compiler doesn't care much for the "do { } while(0|1)"
> blocks, which look to me like some kind of optimization trick
> aimed at a particular compiler.

No, they're not for optimization.  The do {} while (0) is simply a 
construct to allow a macro to behave syntactically exactly like a 
function.  It does not generate any code on any compiler that I'm aware 
of.  However, if it causes warnings, I will use a different, less 
appealing construct.

The do {} while (1) is simply a loop, which I find rather more 
aesthetically pleasing than for (;;), but in the never-ending quest to 
quell the concerns of compilers everywhere, I will change it to the 
latter.  Does while (1) { ... } give a warning on your compiler?

> Also there are warnings when an assignment narrows the variable
> being assigned, such as in CRC2, which exhibits both problems:

More typecasting is no problem.  Please let me know where all the 
instances are.

If anyone else has pesky compiler warnings, also please let me know.  
Thanks.

mark





More information about the Zlib-devel mailing list