Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!titan!drack From: drack@titan.tsd.arlut.utexas.edu (Dave Rackley) Newsgroups: comp.lang.c Subject: Re: Should #include ; compile? Message-ID: Date: 19 Feb 91 14:54:23 GMT References: <7605@jhunix.HCF.JHU.EDU> Sender: news@titan.tsd.arlut.utexas.edu Distribution: usa Organization: Applied Research Laboratories, University of Texas at Austin. Lines: 36 In-reply-to: barrett@jhunix.HCF.JHU.EDU's message of 19 Feb 91 03:28:01 GMT In article <7605@jhunix.HCF.JHU.EDU> barrett@jhunix.HCF.JHU.EDU (Dan Barrett) writes: > Should this program compile? > > #include ; > main() {} > I have one compiler that complains about the semicolon after the ">", and > one that doesn't. Which is right? My suspicion is that the program is > legal, because a semicolon by itself is an empty statement. The error > message produced by the picky compiler is: > > test.c:1: #include expects "fname" or > Both compilers accept: > > #include > ; > main() {} > Preprocessor directives are bounded by *line boundaries* not semi-colons. Per K&R, 2d edition, page 228: "...any character not otherwise defined is taken as a token." Therefore, it is my opinion that your first example should not compile (precompile). -- DISCLAIMER: I, hereby, disclaim any disclaimer except this disclaimer. +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+ | David Rackley | Now comes the really weird part...You know | | Applied Research Laboratories | the part where I know how to tap dance, but | | The University of Texas | only while wearing golf shoes... | | Austin, TX. 78758 | ...Ponderous, man, really ponderous! | +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+