Q-> can you nest comments in var names?

Colin Plumb ccplumb at spurge.uwaterloo.ca
Thu Oct 11 12:58:07 AEST 1990


In article <1990Oct10.211829.3168 at eng.umd.edu> rfink at eng.umd.edu (Russell A. Fink) writes:

> By rules of Kernighan and Ritchie, or standard adaptations of the
> language, can I nest comments within variable names?

> int number;
> printf ("Value is %d", num/* this is obnoxious */ber);

> Is that obnoxious comment permitted, or is it syntactically wrong?

There are tricks I can play with the preprocessor to make it compile
(#define num sizeof, for example), but by ANSI C rules, this must
preprocess to
printf("Value is %d", num ber);

The old Reiser cpp did crunch comments down to nothing, concatenating
tokens, and this was frequently used in wierd ways, e.g.
#define ListOf(type) ListOf/**/type
but this behaviour, while very common on Unix compilers, has always
been non-portable.
-- 
	-Colin



More information about the Comp.std.c mailing list