| Dan Pop 2004-08-31, 3:55 pm |
| In <41337090.4070705@sun.com> Eric Sosman <Eric.Sosman@sun.com> writes:
>Dan Pop wrote:
>
> No; undefined behavior does not require a diagnostic.
>1.6 "Definitions of terms".
>
>
> Yes. 3.6.6.4 "The return statement" says that reaching
>a function's closing } is equivalent to executing a return
>with no value. 2.1.2.2 "Hosted environment" says that if the
>initial invocation of main() executes a return with no value,
>the status returned to the host environment is undefined.
>1.6 "Definitions of terms" says that using an indeterminately
>valued object produces undefined behavior.
If the indeterminately valued object is used *by the C program*.
> If you can argue that the host environment's use of the
>termination status isn't a "use," you can probably get along
>well with Bill Clinton.
1. The termination status is not a C object. It's not even a value with
a C type.
2. Since this use of the termination status is outside of the execution
of the C program (the execution of the C program has terminated by
then), the text of the C standard does not apply to it: it is beyond
the scope of the C standard.
Before being sarcastic, make sure that your brain is fully engaged ;-)
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
|