Re: C as a scripting language
- From: James Kuyper <jameskuyper@xxxxxxxxxxx>
- Date: Mon, 30 Mar 2009 01:05:08 GMT
Harald van Dijk wrote:
On Sun, 29 Mar 2009 13:45:30 -0600, Han from China wrote:Richard Bos wrote:Your implementation does not get to consider that, since the section onIf that's the case, then it should be easy for you to quote that section
<stdio.h> defines what output is, in the context of the C Standard.
Since the return value from main() does not go to a stream (at least
not within C), it is not output.
of the C Standard and show why a conforming C implementation isn't
allowed to consider the return status from main() as a form of output.
More precisely, it is the "termination status returned to the host environment", by either a call to exit() or by returning from the initial call to main(), which is a form of output. The return status from a non-initial call to main() is certainly not a output.
Do you want someone to go over each and every sentence in the standard and explain for each one how it doesn't support your idea of a return status as output? The only relevant thing I can find is 7.19.2p1, and I'm having trouble seeing how you could link return statuses to streams.
This question is being raised in the context of section 4p5, which does not restrict the 'output' to be stream output. The standard does not define 'output', leaving it to be interpreted in accordance with conventional English usage in the context of computer programming. The standard uses the word 'output' in at least one context where it clearly does not refer to stream output: footnote 116 refers to a "memory-mapped input/output port" (I didn't bother searching further after finding the first such example).
I cannot come up with any reasonable definition of the term 'output', consistent with the normal usage of English in the computer world, that includes both stream and port I/O, while failing to include the exit status of the program. This is all information generated by the program, and communicated outward from the program.
I've looked and found several definitions of 'output' that clearly exclude the exit status. However, those same definitions also exclude data written to a file, for precisely the same reason: for some of those definitions, the reason is that the data is not perceived by the user; for other definitions, it is because the data has not exited the computer system. In either case, the reason applies just as easily to the exit status as to data written to a file. I consider this a defect in those definitions. Taken literally, use of those definitions in the interpretation of section 4p5 implies that data written to a file has no effect upon whether or not a program is strictly conforming.
.
- Follow-Ups:
- Re: C as a scripting language
- From: Han from China
- Re: C as a scripting language
- References:
- Re: C as a scripting language
- From: Richard Bos
- Re: C as a scripting language
- From: Han from China
- Re: C as a scripting language
- From: Harald van Dijk
- Re: C as a scripting language
- Prev by Date: Re: please help a beginner
- Next by Date: Re: C as a scripting language
- Previous by thread: Re: C as a scripting language
- Next by thread: Re: C as a scripting language
- Index(es):
Relevant Pages
|