🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #201

Re: ANSI C spec and GNU C preprocessing

#201
From: Joe Buck
Date: Sat, 11 Apr 1992 17:29
33 lines
2193 bytes
In article <1992Apr9.213900.26576@urbana.mcd.mot.com> qbarnes@urbana.mcd.mot.com (Quentin Barnes) writes:

In article <1992Apr9.213900.26576@urbana.mcd.mot.com> you write:
>1) When a conforming preprocessor encounters a '#' directive which
>   is not listed in the preprocessor syntax (ex. '#foo'), what is
>   the correct behavior -- declare a fatal error, display a warning,
>   or pass it unchanged silently to the compiler?
>
>   GNU C silently passes it on and lets the compiler catch the error.
>   Since the spec doesn't say you can do that, I would read that as you
>   can't do it, so it would be a fatal error from the preprocessor.
>   I can't find a place in the spec that says this though.

You won't find such a place in the spec, because the spec doesn't say
that the preprocessor must be a separate pass, and says nothing about
what pass A must pass to pass B, because that's an implementation issue.

The whole reason for some of the traditional-vs-ANSI differences is so
that a single lexer can handle preprocessing and lexing for the compiler;
no separate pass needed, since the preprocessing is now token-based.

So "a conforming preprocessor" is an oxymoron.  ANSI C only says how
the compiler as a whole must behave.

All your other points are wrong because they ignore this point.  The
bit about the #line directives, for example: ANSI specifies the #line
commands that you as the user may give to the compiler.  It says nothing
at all about how cpp communicates with cc1; that's an implementation
detail.


--
Joe Buck	jbuck@ohm.berkeley.edu
Technical Details
Message-ID: <s77mfINNktd@agate.berkeley.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!hri.com!snorkelwacker.mit.edu!ai-lab!ai.mit.edu!gnulists
References: <1992Apr9.213900.26576@urbana.mcd.mot.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!hri.com!snorkelwacker.mit.edu!ai-lab!ai.mit.edu!gnulists
From: jbuck@forney.berkeley.edu (Joe Buck)
Newsgroups: comp.std.c,gnu.gcc.bug
Subject: Re: ANSI C spec and GNU C preprocessing
Message-ID: <s77mfINNktd@agate.berkeley.edu>
Date: 11 Apr 92 17:29:51 GMT
Article-I.D.: agate.s77mfINNktd
References: <1992Apr9.213900.26576@urbana.mcd.mot.com>
Followup-To: comp.std.c,gnu.gcc.bug
Organization: University of California, Berkeley
Lines: 33
Approved: info-gnu@prep.ai.mit.edu
To: gnu-gcc-bug@prep.ai.mit.edu
NNTP-Posting-Host: forney.berkeley.edu