On 2025-11-01 17:39, Tristan Wibberley wrote:
Follow-up set comp.lang.c
On 01/11/2025 02:45, Richard Damon wrote:
.. [stuff I think is about the invalidity of not completing
execution] isn't a valid definition ...
Let's suppose C disallows abort due to external events... Then no
conforming C implementation exists.
I think we must suppose that susceptibility to power-cuts do not
render C implementations non-conforming.
Correct. What a power cut does is make a conforming implementation
of C fail to continue qualifying as a implementation.
In 1.6 of C89, an implementation is defined as "a particular set of
software, running in a particular translation environment under
particular control options, that performs translation of programs
for, and supports execution of functions in, a particular execution environment."
Thus, when the power is cut, the software ceases to run, so it
ceases to be an implementation, and in particular, ceases to be a
conforming implementation.
There's important wording that wasn't added to the standard until
C99 that clarified something that was already considered to be true:
"A program that is correct in all other aspects, operating on
correct data, containing unspecified behavior shall be a correct
program and act in accordance with 5.1.2.3." (4p3). The peculiar
wording is intended to make clear that unspecified behavior does not
relieve an implementation of this requirement.
Section 5.1.2.3 indirectly references most of the rest of the
standard, while defining that only the observable behavior of a
program has to match what the standard says - that behavior doesn't
have to be generated in the fashion that the standard describes.
Section 5.1.2.3 in C99 corresponds to 2.1.2.3 in C89.
The rest of the standard defines, among other things, how a program
exits. If the behavior of the program is not undefined, it can only
exit by reaching the end of the main() function, or by calling
certain library functions. If there is any observable behavior that
allows you determine that it ended by any other method, the
implementation is non-conforming.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,090 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 45:23:19 |
| Calls: | 13,946 |
| Calls today: | 3 |
| Files: | 187,034 |
| D/L today: |
8,062 files (2,942M bytes) |
| Messages: | 2,460,945 |