R
Richard
Martien Verbruggen said:Martien Verbruggen wrote:
[removal of various levels of quotation]
Mistake 4 is the only part of the code that I'm talking about.
Even if there were no other mistakes,
mistake 4 would be sufficient to prevent the program from
being a "correct program".
Whatever behavior results from running that program,
is not defined between the code and the standard.
Even if the behavior is unremarkable, it's still undefined.
Can you quote the bit from the standard that says that it produces
undefined behaviour?
My understanding is, as I have already stated, that it is implementation
defined, not undefined. I base that opinion on 7.19.2-2 in the c99
standard, which defines a text stream, and states:
Whether the last line requires a terminating new-line character is
implementation-defined.
I believe the C90 standard has similar, if not identical, wording.
Previous discussions on this group tend to agree that the above wording
also means that whether a prorgam needs to end its (textual) output with
a newline is implementation defined, not undefined.
A slightly silly question maybe, but how does one know if and when
something is implementation defined? e.g suppose no newline meant system
A crashed every time? Is this now defined behaviour by that
implementation?