Re: printf() question

Discussion in 'C Programming' started by Jun Woong, Jun 26, 2003.

  1. Jun Woong

    Jun Woong Guest

    "Dan Pop" <> wrote in message news:bd7c7a$npe$...
    > In <bcvfpb$pks$> "Jun Woong" <> writes:


    Finally, control is returned to the host environment. If the
    value of status is zero or EXIT_SUCCESS, an implementation-defined
    form of the status successful termination is returned. If the
    value of status is EXIT_FAILURE, an implementation-defined form
    of the status unsuccessful termination is returned. Otherwise
    the status returned is implementation-defined.

    >
    > No, it is entirely related to *generating* the program output. If I
    > call exit(0), what is the value passed to the host environment as the
    > program's exit status? All we know is its interpretation, but not its
    > value.


    You need to tidy up your wording here. If you call exit(0), then the
    value of status is 0 as said above, and what is implementation-defined
    is the form of the status which doesn't necessarily is a form of
    value. If the implementation decides to give a value as the exit
    status, it seems to me that it's out of scope what the value is after
    the program's termination.

    > >Absence of an objection doesn't necessarily mean their agreement.

    >
    > It does, in practice. That's the whole point in participating to a
    > newsgroup.


    The only fact that they participate to a newsgroup doen't oblige them
    to participate in every discussion whenever someone claims something
    different than what they believe in it.

    >
    > It's more than a request for interpretation: the actual wording of the
    > standard needs to be fixed, to eliminate the current contradiction between
    > the definition of strictly conforming program and the specification of
    > exit().


    Agreed; the standard should define the term "output" to override one
    given by ISO 2382-1 or rewrite the specification for the exit status.
    I'll prepare a PDR for this problem.


    --
    Jun, Woong ()
    Dept. of Physics, Univ. of Seoul
    Jun Woong, Jun 26, 2003
    #1
    1. Advertising

  2. Jun Woong

    Dan Pop Guest

    In <bde6c3$s5l$> "Jun Woong" <> writes:

    >"Dan Pop" <> wrote in message news:bd7c7a$npe$...
    >> In <bcvfpb$pks$> "Jun Woong" <> writes:

    >
    > Finally, control is returned to the host environment. If the
    > value of status is zero or EXIT_SUCCESS, an implementation-defined
    > form of the status successful termination is returned. If the
    > value of status is EXIT_FAILURE, an implementation-defined form
    > of the status unsuccessful termination is returned. Otherwise
    > the status returned is implementation-defined.
    >
    >>
    >> No, it is entirely related to *generating* the program output. If I
    >> call exit(0), what is the value passed to the host environment as the
    >> program's exit status? All we know is its interpretation, but not its

    ^^^^^^^^^^^^^^^^^^^^^
    >> value.

    >
    >You need to tidy up your wording here. If you call exit(0), then the


    Nope, you need to read my text carefully and in context.

    >value of status is 0 as said above,


    I was talking about "the program's exit status", not about the value of
    exit's parameter (which happens to be called "status" in the standard).

    >and what is implementation-defined
    >is the form of the status which doesn't necessarily is a form of
    >value.


    If that were true, there would have been no need for
    "implementation-defined" to appear *three* times in that paragraph.
    And the last apparition is not connected with "form" at all. So, it is
    the exit status that is implementation-defined in each of the three
    cases, not its form (which is unspecified, AFAICT).

    E.g. on an implementation supporting 5 different forms of unsuccessful
    termination, the implementation must document which of them is returned
    for EXIT_FAILURE.

    >If the implementation decides to give a value as the exit
    >status, it seems to me that it's out of scope what the value is after
    >the program's termination.


    If it were out of scope, then it wouldn't be implementation-defined,
    would it? The standard can't impose anything about things that are
    beyond its scope, right?

    >> >Absence of an objection doesn't necessarily mean their agreement.

    >>
    >> It does, in practice. That's the whole point in participating to a
    >> newsgroup.

    >
    >The only fact that they participate to a newsgroup doen't oblige them
    >to participate in every discussion whenever someone claims something
    >different than what they believe in it.


    Nevertheless, the history of the newsgroup provides ample evidence that
    they do voice their objections, whenever they have any. I see no good
    reason for that particular discussion to be an exception.

    Dan
    --
    Dan Pop
    DESY Zeuthen, RZ group
    Email:
    Dan Pop, Jun 26, 2003
    #2
    1. Advertising

  3. Jun Woong

    Jun Woong Guest

    "Dan Pop" <> wrote in message news:bdeta5$fim$...
    > In <bde6c3$s5l$> "Jun Woong" <> writes:
    >

    [...]
    > >
    > > Finally, control is returned to the host environment. If the
    > > value of status is zero or EXIT_SUCCESS, an implementation-defined
    > > form of the status successful termination is returned. If the
    > > value of status is EXIT_FAILURE, an implementation-defined form
    > > of the status unsuccessful termination is returned. Otherwise
    > > the status returned is implementation-defined.
    > >

    [...]
    > >and what is implementation-defined
    > >is the form of the status which doesn't necessarily is a form of
    > >value.

    >
    > If that were true, there would have been no need for
    > "implementation-defined" to appear *three* times in that paragraph.
    > And the last apparition is not connected with "form" at all. So, it is
    > the exit status that is implementation-defined in each of the three
    > cases, not its form (which is unspecified, AFAICT).
    >


    You misunderstood my point. What I meant is that the implementation-
    defined form of an exit status can have any different form than a
    value.

    > >If the implementation decides to give a value as the exit
    > >status, it seems to me that it's out of scope what the value is after
    > >the program's termination.

    >
    > If it were out of scope, then it wouldn't be implementation-defined,
    > would it? The standard can't impose anything about things that are
    > beyond its scope, right?
    >


    You are right, I shouldn't have said "out of scope" here. What I meant
    is that the (implementation-defined) statuses for 0, EXIT_SUCCESS and
    EXIT_FAILURE can be excluded from the program's output if the value
    returned by exit() counts as the output, since a program already has a
    portable way to say the successful or unsuccessful termination to the
    environment by calling exit() with 0 or two EXIT_* macros. This
    problem should be considered by the committee, if they want to put the
    exit status into the output.

    > >
    > >The only fact that they participate to a newsgroup doen't oblige them
    > >to participate in every discussion whenever someone claims something
    > >different than what they believe in it.

    >
    > Nevertheless, the history of the newsgroup provides ample evidence that
    > they do voice their objections, whenever they have any. I see no good
    > reason for that particular discussion to be an exception.
    >


    Agreed, but it's still possible for some members in c.s.c to think
    that this problem is not so obvious from the text itself, which needs
    a DR anyway and thus is pointless to discuss in the group.


    --
    Jun, Woong ()
    Dept. of Physics, Univ. of Seoul
    Jun Woong, Jun 26, 2003
    #3
  4. Jun Woong

    Jun Woong Guest

    "Dan Pop" <> wrote in message news:bdha62$m55$...
    > In <bdf9ml$28h$> "Jun Woong" <> writes:
    >

    [...]
    > >
    > >You are right, I shouldn't have said "out of scope" here. What I meant
    > >is that the (implementation-defined) statuses for 0, EXIT_SUCCESS and
    > >EXIT_FAILURE can be excluded from the program's output if the value
    > >returned by exit() counts as the output, since a program already has a
    > >portable way to say the successful or unsuccessful termination to the
    > >environment by calling exit() with 0 or two EXIT_* macros.

    >
    > Nope, they cannot be excluded,


    I meant that if the committee decides to do so, then ...

    [...]
    > >
    > >Agreed, but it's still possible for some members in c.s.c to think
    > >that this problem is not so obvious from the text itself, which needs
    > >a DR anyway and thus is pointless to discuss in the group.

    >
    > Practically everything is possible, in theory. I see little point in
    > considering theoretically possible, but highly unlikely alternatives.
    > If no one objects to a statement, it is quite safe to assume that no one
    > (from the active participants of the newsgroup) has any objections.
    >


    Okay, I'll write both of these alternative approaches for fixing the
    problem when I prepare a PDR.


    --
    Jun, Woong ()
    Dept. of Physics, Univ. of Seoul
    Jun Woong, Jun 27, 2003
    #4
  5. Jun Woong

    Dan Pop Guest

    In <bdhp9h$k0p$> "Jun Woong" <> writes:


    >"Dan Pop" <> wrote in message news:bdha62$m55$...
    >> In <bdf9ml$28h$> "Jun Woong" <> writes:
    >>

    >[...]
    >> >
    >> >You are right, I shouldn't have said "out of scope" here. What I meant
    >> >is that the (implementation-defined) statuses for 0, EXIT_SUCCESS and
    >> >EXIT_FAILURE can be excluded from the program's output if the value
    >> >returned by exit() counts as the output, since a program already has a
    >> >portable way to say the successful or unsuccessful termination to the
    >> >environment by calling exit() with 0 or two EXIT_* macros.

    >>
    >> Nope, they cannot be excluded,

    >
    >I meant that if the committee decides to do so, then ...


    And, as I said, that would require a rewrite of the (relevant part of the)
    standard. Perfectly possible through a future TC.

    Dan
    --
    Dan Pop
    DESY Zeuthen, RZ group
    Email:
    Dan Pop, Jun 30, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edith Gross
    Replies:
    2
    Views:
    329
    =?iso-8859-1?Q?Juli=E1n?= Albo
    Nov 2, 2003
  2. ben
    Replies:
    4
    Views:
    602
    Martin Ambuhl
    Jun 26, 2004
  3. whatluo

    (void) printf vs printf

    whatluo, May 26, 2005, in forum: C Programming
    Replies:
    29
    Views:
    1,228
  4. azza

    printf affects following printf/s

    azza, Oct 17, 2010, in forum: C Programming
    Replies:
    0
    Views:
    427
  5. guru
    Replies:
    8
    Views:
    267
Loading...

Share This Page