[Zlib-devel] [PATCH] Check on _LARGEFILE64_SOURCE and friends are too strict

John Bowler jbowler at frontiernet.net
Thu Apr 1 16:45:48 EDT 2010


From: Xin LI
>It seems that now zlib wants to check whether _LARGEFILE64_SOURCE is 1, 

You patch will cause the _LARGEFILE64_SOURCE code to be enabled if _LARGEFILE_SOURCE is #defined to "0" - this may be correct, but it seems counter-intuitive.

Simply using '_LARGEFILE64_SOURCE' without comparing it:

#if _LARGEFILE64_SOURCE

Achieves the alternative behavior of failing if (either) _LARGEFILE64_SOURCE is undefined or if it is defined to 0, that's because a defined but empty pp-token is evaluated as "1", an undefined token is evaluated as "0".

Normally feature enabling macros that are strictly on/off should just be tested using #if; the worst case is that the result fails at compile time if the ANSI-C semantics aren't supported, but trying to use defined() is also not completely portable.

John Bowler <jbowler at acm.org>






More information about the Zlib-devel mailing list