tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] stringify, another simple C program which doesn't com


From: Michael Matz
Subject: Re: [Tinycc-devel] stringify, another simple C program which doesn't compile
Date: Wed, 3 Jun 2020 18:41:21 +0200 (CEST)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)

Hello,

On Sat, 30 May 2020, Patrick Hammer wrote:

Hi!

The second program also works with Clang, gcc etc., but not with tcc.
It tries to use stringification with a backslash, indirectly:

#include <stdio.h>
#define PRINT_(X) puts(#X);
#define PRINT(X) PRINT_(X)

int main(void)
{
    PRINT(\\)
    return 0;
}

Here the workaround is to use no indirection, to use PRINT_(\\) instead of
PRINT(\\) or to change the definition of PRINT to #define PRINT(X) puts(#X),
in which case the program prints the backslash as expected. However this
isn't a good workaround, as avoiding indirections in the macros can
sometimes be very annoying, luckily it worked in my program though.

Thanks for the report! The error message about backslashes was emitted too early. Fixed in mob.


Ciao,
Michael.

reply via email to

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