Article View: comp.std.c
Article #1822Re: Q-> can you nest comments in var names?
From: Colin Plumb
Date: Thu, 11 Oct 1990 02:58
Date: Thu, 11 Oct 1990 02:58
22 lines
1364 bytes
1364 bytes
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
Technical Details
Message-ID:
<1990Oct11.025807.18532@watdragon.waterloo.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!watdragon!spurge!ccplumbReferences:
<1990Oct10.211829.3168@eng.umd.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c,comp.programmer.c Path: arc1-ca.pugleaf.net!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