Re: AC_CHECK_SIZEOF for members

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

 



> * Paul Eggert <rttreg@xxxxxxxxxxx> [2005-05-10 16:46:27 -0700]:
>
> Sam Steingold <sds@xxxxxxx> writes:
>
>> it appears that AC_CHECK_SIZEOF works only with types, not members.
> Yes, that's correct.  You'd need to write a variant to do what you want.

<screaming in pain>

> Wouldn't it be easier to do this within C?  E.g.:
>
>    struct utmpx u;
>    enum {
>      GLIBC_2_3_2_STRUCT_UTMPX_BUG =
>        (sizeof u.ut_tv != sizeof (struct timeval))
>    };
>    if (GLIBC_2_3_2_STRUCT_UTMPX_BUG) ...

yes, it is easy - but the same holds for sizeof(type_t) - and you _do_
provide a test for that.

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.

thanks.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.jihadwatch.org/> <http://pmw.org.il/> <http://www.dhimmi.com/>
<http://www.camera.org> <http://www.mideasttruth.com/> <http://www.iris.org.il>
If you try to fail, and succeed, which have you done?



_______________________________________________
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