[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_CHECK_SIZEOF for members
From: |
Sam Steingold |
Subject: |
Re: AC_CHECK_SIZEOF for members |
Date: |
Wed, 11 May 2005 09:49:27 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt) |
> * Paul Eggert <address@hidden> [2005-05-10 16:46:27 -0700]:
>
> Sam Steingold <address@hidden> 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?