autoconf
[Top][All Lists]
Advanced

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

Re: determine base type of a typedef


From: Russell Shaw
Subject: Re: determine base type of a typedef
Date: Fri, 23 Oct 2020 19:35:04 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 23/10/20 6:06 pm, Russell Shaw wrote:
On 23/10/20 5:54 pm, Anatoli wrote:
Russell,

Thanks for your suggestion. The problem is, as I mentioned in the initial
post, on amd64 sizeof(time_t) is always 8 bytes, as well as long and long
long, so sizeof(time_t) == sizeof(long int) == sizeof(long long int).

I've actually tried the following directly in configure.ac (for this test
it's not needed to run a custom code):

#if (SIZEOF_TIME_T == SIZEOF_LONG_LONG_INT) #define TIME_T_FMT "%lld" #elif
(SIZEOF_TIME_T == SIZEOF_LONG) #define TIME_T_FMT "%ld" #else #error dont
know what to use for TIME_T_FMT #endif

But both checks are true so it makes no sense.

I need something that would not depend on the size of the type. Not sure it's
even possible.
I might be missing something simple because i got up too early.

If a platform has time_t the same size as a long and long long, does it matter whether the printf uses "%ld" or "%lld" ?

[For GNU C this is "the same" as both are of 8 bytes, but clang generates a warning like: "warning: format specifies type 'long' but the argument has type 'time_t' (aka 'long long')".]

I see that is the actual problem.



reply via email to

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