Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: [Solved] Need some help getting to my feet Date: Fri, 27 Apr 2018 11:26:56 -0700 Organization: None to speak of Lines: 44 Message-ID: References: <87o9i7ovsc.fsf@bsb.me.uk> <752bbd42-4649-4537-bb9a-01ecc72d3b0c@googlegroups.com> <87in8etgms.fsf@bsb.me.uk> <4330b8c3-bcd0-4213-a276-a0c4fb25c810@googlegroups.com> <87y3h9sha3.fsf@bsb.me.uk> <5da45b9b-6b02-4e92-ac51-1abf1e8fe4c4@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="cc0e2a6c7d0567601a378dba59302632"; logging-data="21880"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194MWYU9IRwcCSDe1fnQAq6" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:bCmPvoe6NH0pfNKtHS1/ZjbUtOA= sha1:blgEF2iVVENuNcGZqStMuP1YSVw= Xref: csiph.com comp.lang.c:129868 bartc writes: > On 27/04/2018 18:36, Keith Thompson wrote: >> #include directives don't end in a semicolon because that's the syntax. >> >> The underlying reason, which Schildt could have gone into if he had >> wanted to, is that preprocessor directives are strictly line-oriented, >> so there's no need for semicolons as a separator. His claim that it's >> because "it is an instruction to the C compiler itself" is nonsense. >> Everything in a C source file is an instruction to the C compiler. > > No, it isn't. If I say: > > #include "FILE.H" > > then /that's/ telling the compiler to go and locate that file and to > incorporate the contents into the source. If I say: > > include("FILE.H"); > > then the compiler will /not/ execute this function call. It will make > arrangements for it to be executed at runtime. It instructs the compiler to generate code to call the function. > So I think Schildt was right. I will admit that it's reasonable to say that preprocessor directives are instructions to the compiler, while statements are instructions to do something at compile time. I think my statement that "Everything in a C source file is an instruction to the C compiler." is strictly true, but it is a bit of a stretch. In any case, that was a side point, and not particularly relevant. Schildt's claim that preprocessor directives don't have semicolons *because" they're instructions to the C compiler is nonsense. The preprocessor's syntax could just as easily have been defined using semicolons to terminate directives. (I'm not interested in debating whether that would have been better.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"