From 347d237a114495c0a9b9d14d38551d544dca021d Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 15 Oct 2025 10:48:17 +0200 Subject: test more cpp behavior --- test/pp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/pp.c') diff --git a/test/pp.c b/test/pp.c index 51cf70f..85b4cba 100644 --- a/test/pp.c +++ b/test/pp.c @@ -3,6 +3,8 @@ #include "pp.h" #include #include +#include +#include // #define CATl(a) a##bar #define CATr(a) foo##a @@ -15,6 +17,12 @@ #define join(c, d) in_between(c hash_hash d) char p[] = join(x, y); // equivalent to char p[] = "x ## y"; +#define PUTS p\ +u\ +t\ +s + + int main(void) { @@ -30,5 +38,15 @@ main(void) printf("%s " "%s %g\n", str(Foo,5), xstr(Foo), CAT(1.5,e3f) + CAT(7,)-CAT(,1)); printf("join: \"%s\"\n", p); + + PUT\ +S\ +("Output ends here\\ +0Not printed" /* After line splicing, the remaining backslash + * escapes the 0, ending the string early. + */ +); + + CAT(ret,urn) 0; } -- cgit v1.2.3