Re: AC_CHECK_SIZEOF for members

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

 



Sam Steingold <sds@xxxxxxx> writes:

>> Yes, that's correct.  You'd need to write a variant to do what you want.
>
> <screaming in pain>

It's not that bad, if you can assume Autoconf 2.59.  Just copy the
existing code from the sizeof-using macro, and repair it to allow
objects rather than types.

> 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.

Also, unless there is a serious efficiency issue (not likely here) or
some other issue I don't quite follow, I'd write the code like this:

  a_function_expecting_64_bit_argument (u.ut_tv.tv_sec);

This will work fine on C89 and better, if you've prototyped the function.


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux