Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #110262
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Token concatenation |
| Date | 2017-05-18 11:17 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87lgpuzcy5.fsf@bsb.me.uk> (permalink) |
| References | <eo4bg1Flha4U1@mid.individual.net> |
Hans-Peter Diettrich <DrDiettrich1@aol.com> writes: > In the Windows headers (driverspecs.h) I found a strange use of the ## operator, like this pattern: > #define foo(x) bar(##baz(x)) > > A (baz concatenation is invalid, does not result in a valid > preprocessor token. I'm stumped as to the purpose since, as you say, it's undefined. My only thought is that in an implementation where an invalid pasting produces some new symbol unlike the old one this code might prevent baz from being expanded no matter what defines are in place at the time. If you can find a compiler that does not complain (presumably the one the header file is intended for) you could try #define foo(x) bar(##baz(x)) #define baz(x) BAZ[x] #define s(x) S(x) #define S(x) #x s(foo(arg)) so see if that gives you any clues. -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
Token concatenation Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2017-05-18 03:25 +0200 Re: Token concatenation Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-18 11:17 +0100
csiph-web