Article View: mod.std.c
Article #71mod.std.c Digest V5#8
From: Orlando Sotomayor-Diaz
Date: Wed, 24 Apr 1985 13:38
Date: Wed, 24 Apr 1985 13:38
84 lines
3426 bytes
3426 bytes
From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>
mod.std.c Digest Wed, 24 Apr 85 Volume 5 : Issue 8
Today's Topics:
comments in pre-processor lines
CTRL(x) in the ANSI standard
----------------------------------------------------------------------
Date: Tue, 23 Apr 85 00:25:06 cst
From: ihnp4!ut-sally!cyb-eng!bc
Subject: comments in pre-processor lines
I am relatively new to the net, and perhaps I have missed some dialogue,
but it just seems crazy to me to impose a free-format comment mechanism
like /* */ onto preprocessor lines. As stated on p. 207 of K&R, "These
lines have syntax independent of the rest of the language; ...". What is
a preprocessor to do if he sees a /* and no */? His scanning stops at the
end of the current line. Does he pick up *inside comment* on the next
preprocessor line? This is ridiculous!
Nowhere I have been able to find is /* */ considered to be white space by
a *preprocessor*! All those characters are just characters to him/her.
I will let Dennis Ritchie speak for himself (I haven't seen any comment by
him on this topic), but if I were to guess how he would have implemented
the idea of comments on preprocessor lines -- given their line-oriented,
relatively fixed-format structure, he would have suggested that anything
after a second # on the same line be considered a comment. Certainly MY
vote would go for that.
So you say:
#ifdef VERBOSE
...
#endif #VERBOSE
Not so bad.
------------------------------
Date: Tue, 23 Apr 85 17:08:17 est
From: <ihnp4!decvax!mcnc!rtp47!gamma>
Subject: CTRL(x) in the ANSI standard
I just realized there is another method of supporting the CTRL macro
which I believe is in /usr/include/sys/types.h. It is somewhat longer
than the previous method of derefencing a string made from the argument,
but should work in case statements, and static initializations.
enum _CTRL_kludge {
_CTRL_A = 1, /* upper case control chars */
_CTRL_B,
_CTRL_C,
...
_CTRL_Y,
_CTRL_Z,
_CTRL_a = 1, /* handle lower case as well */
_CTRL_b,
_CTRL_c,
....
_CTRL_y,
_CTRL_z
};
#define CTRL(arg) ((int) _CTRL_ ## arg)
Thus, instead of using string-izing, it uses token pasting, and it could
be easily adapted to work on EBCDIC as well (if it supports the notion of
control characters), which the old 'x' & 077 does not.
Michael Meissner
Data General Corporation
...ihnp4!mcnc!rti-sel!rtp47!meissner
------------------------------
End of mod.std.c Digest - Wed, 24 Apr 85 08:35:15 EST
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c@BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.
Technical Details
Message-ID:
<902@homxa.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!decvax!bellcore!allegra!ulysses!mhuxr!mhuxt!houxm!homxa!osd7Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83 based; site homxa.UUCP Path: arc1-ca.pugleaf.net!utzoo!decvax!bellcore!allegra!ulysses!mhuxr!mhuxt!houxm!homxa!osd7 From: osd7@homxa.UUCP (Orlando Sotomayor-Diaz) Newsgroups: mod.std.c Subject: mod.std.c Digest V5#8 Message-ID: <902@homxa.UUCP> Date: Wed, 24-Apr-85 08:38:16 EST Article-I.D.: homxa.902 Posted: Wed Apr 24 08:38:16 1985 Date-Received: Wed, 24-Apr-85 14:26:22 EST Organization: AT&T Bell Labs, Holmdel NJ Lines: 84 Approved: osd7@homxa.UUCP