On 10/26/20 8:48 AM, Bob Friesenhahn wrote:
The approach that Paul Eggert suggests is very interesting, but it might not
provide absolute proof of the C type since the compiler/linker might allow
success if the types are the same size.
Not a problem in practice. The C standard requires a
On Fri, 23 Oct 2020, Vivien Kraus wrote:
Is it not possible to always use "%lld" and always convert the
arguments to (long long int)?
The way I have been doing things for many years is to get the size of
the underlying type and then include a cast in the printf arguments to
a type of the
On 10/25/20 3:00 PM, Anatoli wrote:
If I understand you correctly, I should use something like AC_COMPILE_IFELSE
with the code with a redefine as you specified, right?
Yes, that's the idea.
Nick,
Thanks for your suggestions! They gave me some additional keywords to search for
more ideas.
After trying your code I found that I could actually use _Generic directly in
the C sources, no need for autoconf, e.g.:
time_t _unused_t;
#define TIME_T_FMT _Generic((_unused_t), long long int:
Paul,
Thanks for your suggestion.
If I understand you correctly, I should use something like AC_COMPILE_IFELSE
with the code with a redefine as you specified, right?
Something like:
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include
extern time_t foo;
extern long long int
On 2020-10-23, Nick Bowler wrote:
> On 23/10/2020, Paul Eggert wrote:
>> On 10/22/20 6:09 PM, Russell Shaw wrote:
>>> else if(sizeof(time_t) == sizeof(long int)) {
>>
>> This is not the right kind of test. You want to test whether time_t and
>> int
>> are
>> the same types, not whether
On 23/10/2020, Paul Eggert wrote:
> On 10/22/20 6:09 PM, Russell Shaw wrote:
>> else if(sizeof(time_t) == sizeof(long int)) {
>
> This is not the right kind of test. You want to test whether time_t and int
> are
> the same types, not whether they're the same size. To do that, you should
> use
On 10/22/20 6:09 PM, Russell Shaw wrote:
else if(sizeof(time_t) == sizeof(long int)) {
This is not the right kind of test. You want to test whether time_t and int are
the same types, not whether they're the same size. To do that, you should use
code like this:
extern time_t foo;
extern
Yeah, though the idea is not to silence the compiler, but to find a solution to
the problem and make the compiler happy.
On 23/10/20 06:19, Peter Johansson wrote:
>
> On 23/10/20 6:39 pm, Russell Shaw wrote:
>> If the compiler complains, then maybe you could capture that complaint
>> output.
On 23/10/20 6:39 pm, Russell Shaw wrote:
If the compiler complains, then maybe you could capture that complaint
output.
Bit of a messy test.
When trying to detect compiler warnings, I've found AC_LANG_WERROR useful
> Is it not possible to always use "%lld" and always convert the
> arguments to (long long int)?
This is what I'm doing right now. GCC on Linux doesn't generate any
warnings in any case, though I'm not sure this is a clean way of doing
things, taking into account Clang on other archs and
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
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
Russell,
> 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" ?
>From my first mail:
> 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
>
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
Hello Anatoli,
Le jeudi 22 octobre 2020 à 19:23 -0300, Anatoli a écrit :
> #if (AC_TYPE(time_t) == "long long int")
> #define TIME_T_FMT "%lld"
> #elif (AC_TYPE(time_t) == "long int")
> #define TIME_T_FMT "%ld"
> #else
> #error dont know what to use for TIME_T_FMT
> #endif
Is it not possible to
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
On 23/10/20 9:23 am, Anatoli wrote:
Hi All,
Is there a way to determine with autoconf what's the base type of a typedef?
I'm trying to accomplish the following:
There are standard types time_t, off_t, size_t and similar that are defined
differently on different platforms/OS.
For example,
Hi All,
Is there a way to determine with autoconf what's the base type of a typedef?
I'm trying to accomplish the following:
There are standard types time_t, off_t, size_t and similar that are defined
differently on different platforms/OS.
For example, time_t is defined as "long int" on Linux
19 matches
Mail list logo