Article View: comp.std.c
Article #200Re: ANSI C spec and GNU C preprocessing
From: Chris Torek
Date: Sat, 11 Apr 1992 07:58
Date: Sat, 11 Apr 1992 07:58
37 lines
2411 bytes
2411 bytes
In article <1992Apr9.213900.26576@urbana.mcd.mot.com> qbarnes@urbana.mcd.mot.com (Quentin Barnes) writes: >I have a few questions about the ANSI C spec (X3.159-1989 section >3.8) and how an ANSI C preprocessor should behave. The ANSI standard does not concern itself with separate preprocessors. It defines only a `preprocessing phase' of C compilation. Whether that is implemented separately, or as part of an integrated compiler program, is up to the implementation. >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? When a conforming *compiler* (including all 7 phases) encounters an program violating a constrant, it must emit at least one diagnostic. >2) A conforming preprocessor must output line directives (3.8.4) ... 3.8.4 deals with *input* line directives. GCC's cpp could emit encrypted binary data and still conform, as long as the rest of the system performed according to the specifications. The C standard acts as a contract between a `user' and an `implementor'. Each may view the other as a `black box'. The user is required to feed the implementor conforming code; the implementor is required to accept conforming code and produce conforming output. The black boxes, in this case, are defined only at the level of `C source code' and `observable behavior when running the compiler and the compiled code'. The preprocessor, if there is a separate one, is not considered an `observable part'. -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov
Technical Details
Message-ID:
<22650@dog.ee.lbl.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!yale.edu!yale!mintaka.lcs.mit.edu!ai-lab!ai.mit.edu!gnulistsReferences:
<1992Apr9.213900.26576@urbana.mcd.mot.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!yale.edu!yale!mintaka.lcs.mit.edu!ai-lab!ai.mit.edu!gnulists From: torek@horse.ee.lbl.gov (Chris Torek) Newsgroups: comp.std.c,gnu.gcc.bug Subject: Re: ANSI C spec and GNU C preprocessing Message-ID: <22650@dog.ee.lbl.gov> Date: 11 Apr 92 07:58:13 GMT Article-I.D.: dog.22650 References: <1992Apr9.213900.26576@urbana.mcd.mot.com> Reply-To: torek@horse.ee.lbl.gov (Chris Torek) Followup-To: comp.std.c,gnu.gcc.bug Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 37 Approved: info-gnu@prep.ai.mit.edu To: gnu-gcc-bug@cis.ohio-state.edu NNTP-Posting-Host: 128.3.112.15