tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] simple #ifdef causes "error: function pointer expecte


From: Massimo Sala
Subject: Re: [Tinycc-devel] simple #ifdef causes "error: function pointer expected"
Date: Thu, 21 May 2020 14:49:11 +0200

I read about this topic.

Arnold wrote:
    This isn't valid C. The preprocessor doesn't know about sizeof.

I found this:
    C99 doesn't require support for "sizeof" in preprocessor conditionals and gcc for example doesn't support it.

Indeed this snippet compiles and run like a charm:

int main()
{
#define big sizeof(size_t)
printf("big boss %zd\n", big);
return 0;
}


Any suggestion how to check with macro the sizeof size_t ?
Should I check the max value of a size_t to infer its size ?

M


On Thu, 21 May 2020 at 14:17, Massimo Sala <address@hidden> wrote:
Ops.

Pls any suggestion how to check with macro the sizeof size_t ?
Should I check the max value of a size_t to infer its size ?
I cannot find how to.

M

On Thu, 21 May 2020 at 14:08, <address@hidden> wrote:
This isn't valid C. The preprocessor doesn't know about sizeof.

Arnold

Massimo Sala <address@hidden> wrote:

> Hi
>
> Compiling the attached sample, tcc bails out with "error: function pointer
> expected"
> Pls, how can I fix ?
> Best regards, Massimo
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
>
> int main()
> {
> printf("ciao\n");
> #if sizeof(size_t) == 64
> printf("big boss\n");
> #endif
> return 0;
> }

reply via email to

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