🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Andreas Schwab Mon, 09 Nov 1992 12:11
Bugs in CPP 2.2.2
#1319
Author: Andreas Schwab
Date: Mon, 09 Nov 1992 12:11
42 lines
1346 bytes
1. Hexadecimal numbers can confuse token parsing.

---- bug1.c
#define A 1

int i = 0x2e+A;
int j = 0x2e+ A;
----

Output of: gcc -E bug1.c
----
# 1 "bug1.c"


int i = 0x2e+A;
int j = 0x2e+ 1 ;
----

2. Macro parameters which are only to be stringified or concatenated, but
not exapanded are nevertheless expanded internally and can lead to
errors and strange effects.

---- bug2.c
#define k(a) #a

char *s = k(k(1,2));
char *t = k(#) k(#undef k) k(x);	/* feature?? */
----

Output of: gcc -E bug2.c
----
bug2.c:3: macro `k' used with too many (2) args
bug2.c:4: invalid preprocessor directive name
# 1 "bug2.c"


char *s = "k(1,2)" ;
char *t = "#"  "#undef k"  k(x);	 
----
--
Andreas Schwab
schwab@ls5.informatik.uni-dortmund.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads