Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #62900

Re: About freestanding C

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: About freestanding C
Date 2015-05-31 23:50 -0700
Organization None to speak of
Message-ID <87siabhqhh.fsf@kst-u.example.com> (permalink)
References <c85af478-5e21-456f-9ac6-c2a054bea9da@googlegroups.com> <87eglwih4u.fsf@kst-u.example.com> <MPG.2fd5795814c9cee132@news.eternal-september.org>

Show all headers | View raw


Philip Lantz <prl@canterey.us> writes:
> Keith Thompson wrote:
>> David Kleinecke <dkleinecke@gmail.com> writes:
>> > Many people are unaware of it but C comes in two forms. According to 
>> > clause 4 of the C90 standard (and, I assume, all the  later versions):
>> >
>> > The two forms of conforming implementation are hosted and freestanding. 
>> 
>> > I do not know whether the standard means by the second sentence in 
>> > 5.1.2.1 that the reserved identifiers of 7.1.3 are not reserved in a 
>> > freestanding C implementation.
>> 
>> In the C90 standard, the first paragraph of 5.1.2.1 is:
>> 
>>     In a freestanding environment (in which C program execution
>>     may take place without any benetit of an operating system),
>>     the name and type of the function called at program startup
>>     are implementation-defined. There are otherwise no reserved
>>     external identitiers.  Any library tacilities available to a
>>     freestanding propram are implementation-defined.
[...]
>> That sentence does not appear in the C99 or C11 standard.
[...]
>> I'm not sure what the omission implies.  Personally, I'd try to avoid
>> reserved identifiers even when using a freestanding implementation,
>> simply because it's easy to do so and it avoids confusion.
>
> To me, the sentence in question (C90, 5.1.2.1p1, second sentence) 
> implies that the name of the function called at program startup is a 
> reserved identifier. I speculate that that was not what they meant, so 
> they removed the sentence, to avoid the implication. (I don't think 
> 'main' is a "reserved identifier" in a hosted implementation, is it?)

That's plausible.

> C11, 7.1.3p2 says "No other identifiers are reserved" (where "other" 
> refers to the list in 7.1.3p1). I don't know whether that sentence was 
> there in C90 (I don't have it handy at the moment); perhaps it was 
> inserted in C99 when the second sentence in 5.1.2.1p1 was removed?

Yes, the "No other identifiers are reserved" sentence is in C90.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
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"

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

About freestanding C David Kleinecke <dkleinecke@gmail.com> - 2015-05-31 12:27 -0700
  Re: About freestanding C Ian Collins <ian-news@hotmail.com> - 2015-06-01 08:48 +1200
  Re: About freestanding C Keith Thompson <kst-u@mib.org> - 2015-05-31 14:14 -0700
    Re: About freestanding C Philip Lantz <prl@canterey.us> - 2015-05-31 21:03 -0700
      Re: About freestanding C Keith Thompson <kst-u@mib.org> - 2015-05-31 23:50 -0700

csiph-web