[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CHECK_SIZEOF for members

From: Allan Clark
Subject: Re: AC_CHECK_SIZEOF for members
Date: Thu, 12 May 2005 17:15:49 +0800
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.7) Gecko/20050414

Paul Eggert wrote:

>Sam Steingold <address@hidden> writes:
>>the reason I want a CPP macro and not a run-time if is that the code
>>will end up looking like this:
>>  if (size_of(u.ut_tv.tv_sec) = 4)
>>    a_function_expecting_32_bit_argument(u.ut_tv.tv_sec);
>>  else
>>    a_function_expecting_64_bit_argument(u.ut_tv.tv_sec);
>>the result is that on _each_ platform there will be a compile-time
>>warning about a wrong argument type.
>My suggestion is to fix the compiler, or get a better compiler, or
>ignore the warnings.  Your life is too short to waste it worrying
>about incorrect compiler warnings.
Some of us actually check our compiler warnings, and are happy about
warning-free code.  I won't be the first to tell you that the warning
that is a real error (ie "=" used where "==" was intended) is often
hidden in the middle of these warnings you tend to ignore.  GCC has this
behavior, but whether it's "better" than whatever you're using is
subjective and probably not based solely on whether it points out
user-errors that might be real errors.  GCC has no "pragma -warn ..."
ability to avoid warnings for a block of code, so those of us who care
tend to try to make code that doesn't cause warnings, so the real
warnings stand out regardless whether the end-user of the code compiles
on a "better" compiler or just a more common one.

Disclaimer: it still bothers me that rpcgen-generated *_xdr.c throws so
many warnings.  :)

You don't need to be famous to be right

reply via email to

[Prev in Thread] Current Thread [Next in Thread]