For Programmers: Free Programming Magazines  


Home > Archive > C > August 2004 > Re: C 99 compiler access









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: C 99 compiler access
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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com