rcd@opus.UUCP (05/09/84)
It has already been noted (see ref) that you can concatenate tokens with the preprocessor (at least in 4.x BSD; I don't know whether this is epidemic) with: #define CAT(x,y) x/**/y with the preprocessor discarding comments. As noted earlier, this is not only grungy, it gives lint a lot of grief. --- A second solution is to use the interpretation of \ at end of line: #define CAT(x,y) x\ y which seems a little cleaner, but I'm still dubious; it seems like a dark corner. I think it's safe to conclude that the preprocessor can't rejoin lines when the first ends with \, but that the lex. analyzer must do so... Still, I don't like it very much. --- Yet a third, and in some sense the one that seems least grungy (but it's the fault of nbires!vjs if you don't like it:-) is: #define I(x) x #define CAT(x,y) I(x)y I is just an "identity macro" which gives you a chance to get something between the x and y (a parenthesis) in the definition of CAT. --- Anyone care to comment on esthetics? I'd also like to hear of compilers for which the latter two don't work. -- ...Nothing left to do but smile, smile, smile. Dick Dunn {hao,ucbvax,allegra}!nbires!rcd (303) 444-5710 x3086