[comp.lang.c] Ansi cpp question

asherman@dino.ulowell.edu (Aaron Sherman) (09/28/90)

I've heard that Ansi supports cpp directives that are NOT at the beginning
of a line. How prevelant is this? Do most implimentations these support this
ANSIism?

Thanks.


			-AJS
--
asherman@dino.ulowell.edu	or	asherman%cpe@swan.ulowell.edu
Note that as of 7/18/90 that's asherman@dino.cpe.ulowell.edu
"That that is is that that is not is not is that it it is."

paul@u02.svl.cdc.com (Paul Kohlmiller) (09/29/90)

asherman@dino.ulowell.edu (Aaron Sherman) writes:


>I've heard that Ansi supports cpp directives that are NOT at the beginning
>of a line. How prevelant is this? Do most implimentations these support this
>ANSIism?
I think you refer to the ANSI C requirement that whitespace can be used in
front of a preprocessor directive. I know of at least one non-ANSI C compiler
(mine) that supports this.
Paul Kohlmiller

roger@everexn.com (Roger House) (10/02/90)

In <ASHERMAN.90Sep27131220@dino.ulowell.edu> asherman@dino.ulowell.edu (Aaron Sherman) writes:

>I've heard that Ansi supports cpp directives that are NOT at the beginning
>of a line. How prevelant is this? Do most implimentations these support this
>ANSIism?

Microsoft C allows whitespace before "#" on preprocessor lines.  I find this
quite useful for for indenting nested #if, #else, etc.

						Roger House

jeffb@aquifer.las.uiuc.edu (Jeffrey Biesiadecki) (10/07/90)

asherman@dino.ulowell.edu (Aaron Sherman) writes:

>I've heard that Ansi supports cpp directives that are NOT at the beginning
>of a line. How prevelant is this? Do most implimentations these support this
>ANSIism?

I've seen compilers on mainframes that will not accept white space before
the #...  A safer way to indent cpp directives is to have white space after
the #, like:

#ifdef TOPLEVEL
#  define EXTERN /* nothing */
#else
#  define EXTERN extern
#endif

Jeff Biesiadecki
(jeffb@aquifer.las.uiuc.edu)

amoss@SHUM.HUJI.AC.IL (Amos Shapira) (10/08/90)

rexn.com>
Organization: The Hebrew University of Jerusalem, Israel
Lines: 19
Apparently-To: post-usenet@ucbvax.berkeley.edu

roger@everexn.com (Roger House) writes:

>Microsoft C allows whitespace before "#" on preprocessor lines.  I find this
>quite useful for for indenting nested #if, #else, etc.

>      Roger House

In case you want to do this on a "traditional" pre-processor, it is possible
to put white-space between the '#' sign (which stays in the first column) and
the rest of the directive, it has the same effect as far as the readability
is concerned.

Cheers,
Amos Shapira,
MOSIX System Group,
Hebrew University,
Jerusalem, Israel

#include <std_disclaimer.h>