Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: C, embedded comments and preprocessors
Message-ID: <1990Sep20.155002.7654@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <9009191929.AA13849@lilac.berkeley.edu>
Date: Thu, 20 Sep 90 15:50:02 GMT

In article <9009191929.AA13849@lilac.berkeley.edu> lwv27@CAS.BITNET writes:
>...until it ran into a line like:
>
>lines of various text's comments
>
> ...
>Is it common for a preprocessor to disallow embedded comments?
>... I am just trying to decide if this is a unique
>occurance, fairly common, a required behavior by ANSI C stds now, etc.

ANSI C is quite explicit that everything outside comments (remembering
that comments do not nest in C, and never have) must be legal tokens,
or at least preprocessor tokens if inside the body of a "false" #if[][def]
(which is what you should be using to delete text).  There is some weasel-
wording which permits a compiler to be tolerant of lines like yours, *if*
they are inside a false #if, but this is not required behavior and relying
on it is not portable.

You should be using #if to "comment out" program text, and putting human-
language comments inside /* */.
-- 
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday|  henry@zoo.toronto.edu   utzoo!henry
