[Zlib-devel] TR: the win32\Makefile.msc diff
William A. Rowe Jr.
wrowe at rowe-clan.net
Mon Mar 22 03:06:15 EDT 2010
On 3/22/2010 2:06 AM, Jonathan Nieder wrote:
> William A. Rowe Jr. wrote:
>>>> On 3/21/2010 4:22 PM, Enrico Weigelt wrote:
>
>>>>> But you can make the compiler fail if sizeof(..) doesnt match a
>>>>> specific size, so use for a compile-test (in ./configure).
> [...]
>> But is this a compile-time fail or a runtime fail?
>
> It fails at compile time. You can declare an array like this:
>
> int dummy[(sizeof(z_off64_t) != 8) ? -1 : 1];
>
> sizeof(z_off64_t) is a compile-time constant, and as long as it is 8,
> this is valid C, declaring a one-element array. If it is not 8, then
> this code fails to compile.
>
> It’s an old trick. I doubt it originated with the Linux kernel.
Slick ;-) Worthy waste of 8 bytes - thanks!
More information about the Zlib-devel
mailing list