Newsgroups: comp.std.c,comp.programmer.c Path: utzoo!utgpu!watserv1!maytag!watdragon!spurge!ccplumb From: ccplumb@spurge.uwaterloo.ca (Colin Plumb) Subject: Re: Q-> can you nest comments in var names? Message-ID: <1990Oct11.025807.18532@watdragon.waterloo.edu> Keywords: C, c, identifiers, nested, comments, Kernighan, Ritchie Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes) Organization: University of Waterloo References: <1990Oct10.211829.3168@eng.umd.edu> Date: Thu, 11 Oct 90 02:58:07 GMT Lines: 22 In article <1990Oct10.211829.3168@eng.umd.edu> rfink@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