🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by John MAX Skaller Sun, 04 Oct 1992 08:57
Help Preprocessor
#743
Author: John MAX Skaller
Date: Sun, 04 Oct 1992 08:57
44 lines
1845 bytes
I've got a few minor problems with the specifications for the
preprocessor.

The issue of incomplete /* comments in preprocessor commands is one.

#define fred a + /* incomplete
comment spans lines here */ b

Is the above legal?

The ARM claims

"The source text is decomposed into preprocessing tokens and sequences
of white space. A single white space replaces each comment. A source
file may not end in a partial comment.

[Then, on the next pass]

"Preprocessing directives are executed and macros expanded".

This is a bit tricky. For a start this seems to imply
preprocessor commands can be continued by comments, since
the comments are just replaced by white.

But then it is absurd because if all the newlines were replaced
by white (they are white anyhow) then there would be no way
to delimit the end of the preprocessor command.

Secondly, there might be problems with

#include <filename>

since the < and > are toke. But the filename is implementation dependent.
To fix this, one would have to parse the '#include' tokenising
the rest of the line. (contrary to the ARM requirement).

Any help?


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
Re: Help Preprocessor
#750
Author: Jerry Schwarz
Date: Mon, 05 Oct 1992 16:13
29 lines
1468 bytes
My apologies for the empty article that I just inadvertantly
distributed with this title.

In article <1992Oct4.085733.7703@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
|> I've got a few minor problems with the specifications for the
|> preprocessor.
|> 
|> The issue of incomplete /* comments in preprocessor commands is one.
|> 
|> #define fred a + /* incomplete
|> comment spans lines here */ b
|> 
|> Is the above legal?
|> 

I belive it is very likely that the final C++ standard will
adapt the  the ANSI/ISO C standard's preprocessing mechanism.
(The main difference is the existence of // comments).  Under
that assumption the above will certainly be legal.  Treatment
of "#include <...>" will also be essentially identical to
that in the C standard.  

But at the moment many C++ implementations are built on
non standard preprocessors and their handling of these
issues may not be identical to that of a standard conforming
C compiler.   For maximum portability, don't put comments
into #defines

    -- Jerry Schwarz
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads