Re: parameter argc is never used ?

Discussion in 'C++' started by Default User, Apr 1, 2004.

  1. Default User

    Default User Guest

    Old Wolf wrote:
    >
    > Default User <> wrote:
    > > I meant in this instance. The argc parameter is there for a reason, and
    > > should be used any time argv is used. If you are expecting arguments,
    > > check to see if any arrived. If not, catch it and report it right in
    > > main().

    >
    > argv is guararanted to be a NULL-terminated list, so it is possible
    > to use it without using argc.


    Yes, you CAN, but only by iterating over all elements. Why do that when
    a simple comparison of an int is available?

    This is pretty silly, people coming up with bizarre reasons not to use a
    very handy piece of information.




    Brian Rodenborn
     
    Default User, Apr 1, 2004
    #1
    1. Advertising

  2. Default User

    Julie Guest

    Default User wrote:
    >
    > Old Wolf wrote:
    > >
    > > Default User <> wrote:
    > > > I meant in this instance. The argc parameter is there for a reason, and
    > > > should be used any time argv is used. If you are expecting arguments,
    > > > check to see if any arrived. If not, catch it and report it right in
    > > > main().

    > >
    > > argv is guararanted to be a NULL-terminated list, so it is possible
    > > to use it without using argc.

    >
    > Yes, you CAN, but only by iterating over all elements. Why do that when
    > a simple comparison of an int is available?
    >
    > This is pretty silly, people coming up with bizarre reasons not to use a
    > very handy piece of information.
    >
    > Brian Rodenborn


    Default -- nothing against you, but what I find most 'interesting' about this
    (and other) threads is the inability of respondents to actually *answer* the
    OPs question, but rather why they should be doing it some other way. It makes
    it a very daunting effort to post a question to the newsgroup, and I presume
    that there are numerous lurkers that refrain from posting for this simple
    reason.

    Personally, I take the the OPs question *literally* and try to answer what they
    are asking. If they want comments on code style, how to do it better, etc.,
    let them ask.
     
    Julie, Apr 1, 2004
    #2
    1. Advertising

  3. Default User

    Default User Guest

    Julie wrote:

    > Default


    You can call me Def.

    > -- nothing against you, but what I find most 'interesting' about this
    > (and other) threads is the inability of respondents to actually *answer* the
    > OPs question, but rather why they should be doing it some other way.


    There is no answer. The standard does not require a diagnostic, so the
    fact that one is issued is an implementation decision.

    However, so what? What's wrong with giving a person the real answer,
    rather than the one they think they want do to their broken solution to
    a problem.

    Sometimes, the answer to, "it hurts when I do this" really is, "don't do
    that!"

    > It makes
    > it a very daunting effort to post a question to the newsgroup, and I presume
    > that there are numerous lurkers that refrain from posting for this simple
    > reason.


    Sounds like a load of crap. Nobody was mean to the poster. You have to
    be pretty thin-skinned to take advice saying, "rather than try to
    suppress the warning, use the parameter and eliminate it" as anything
    but constructive advice.

    > Personally, I take the the OPs question *literally* and try to answer what they
    > are asking. If they want comments on code style, how to do it better, etc.,
    > let them ask.


    That's foolish. Sorry if that hurts your feelings, but it's true. ANY
    person in the position of giving advice who strictly limits themselves
    to the actual question does the questioner no service. One should and
    really MUST give the person all the information they need to make a
    sensible decision.



    Brian Rodenborn
     
    Default User, Apr 1, 2004
    #3
  4. Default User

    Pete Vidler Guest

    Default User wrote:
    [snip]
    > That's foolish. Sorry if that hurts your feelings, but it's true. ANY
    > person in the position of giving advice who strictly limits themselves
    > to the actual question does the questioner no service. One should and
    > really MUST give the person all the information they need to make a
    > sensible decision.

    [snip]

    In many cases we know so little about the actual problem that it would
    be an invalid assumption to think that we know it better than they.
    Offering extra advice is often useful, but not at the expense of
    answering the /actual/ question (which would be frustrating to the
    person doing the asking).

    Although in this specific case I think I agree with you.

    -- Pete
     
    Pete Vidler, Apr 1, 2004
    #4
  5. Default User

    Julie Guest

    Default User wrote:
    > Sounds like a load of crap. Nobody was mean to the poster. You have to
    > be pretty thin-skinned to take advice saying, "rather than try to
    > suppress the warning, use the parameter and eliminate it" as anything
    > but constructive advice.


    Yes, no one was mean, but
    >
    > > Personally, I take the the OPs question *literally* and try to answer what they
    > > are asking. If they want comments on code style, how to do it better, etc.,
    > > let them ask.

    >
    > That's foolish. Sorry if that hurts your feelings, but it's true. ANY
    > person in the position of giving advice who strictly limits themselves
    > to the actual question does the questioner no service. One should and
    > really MUST give the person all the information they need to make a
    > sensible decision.


    Doesn't hurt my feelings at all --

    Not foolish, just a fundamental difference -- I prefer to think of the original
    poster being capable to ask what they want, and follow-up as necessary, you
    don't.
     
    Julie, Apr 2, 2004
    #5
  6. Default User

    Default User Guest

    Pete Vidler wrote:
    >
    > Default User wrote:
    > [snip]
    > > That's foolish. Sorry if that hurts your feelings, but it's true. ANY
    > > person in the position of giving advice who strictly limits themselves
    > > to the actual question does the questioner no service. One should and
    > > really MUST give the person all the information they need to make a
    > > sensible decision.

    > [snip]
    >
    > In many cases we know so little about the actual problem that it would
    > be an invalid assumption to think that we know it better than they.
    > Offering extra advice is often useful, but not at the expense of
    > answering the /actual/ question (which would be frustrating to the
    > person doing the asking).


    Which is why we ask for complete, minimal programs, so we can give
    proper advice.

    I knew from looking at this code that the program passed the argv array
    to a function without having performed any sanity checks on the number
    of input arguments. How much more did I need to know?



    Brian Rodenborn
     
    Default User, Apr 2, 2004
    #6
  7. Default User

    Shea Martin Guest

    Julie wrote:
    > Default User wrote:
    >
    >>Old Wolf wrote:
    >>
    >>>Default User <> wrote:
    >>>
    >>>>I meant in this instance. The argc parameter is there for a reason, and
    >>>>should be used any time argv is used. If you are expecting arguments,
    >>>>check to see if any arrived. If not, catch it and report it right in
    >>>>main().
    >>>
    >>>argv is guararanted to be a NULL-terminated list, so it is possible
    >>>to use it without using argc.

    >>
    >>Yes, you CAN, but only by iterating over all elements. Why do that when
    >>a simple comparison of an int is available?
    >>
    >>This is pretty silly, people coming up with bizarre reasons not to use a
    >>very handy piece of information.
    >>
    >>Brian Rodenborn

    >
    >
    > Default -- nothing against you, but what I find most 'interesting' about this
    > (and other) threads is the inability of respondents to actually *answer* the
    > OPs question, but rather why they should be doing it some other way. It makes
    > it a very daunting effort to post a question to the newsgroup, and I presume
    > that there are numerous lurkers that refrain from posting for this simple
    > reason.
    >
    > Personally, I take the the OPs question *literally* and try to answer what they
    > are asking. If they want comments on code style, how to do it better, etc.,
    > let them ask.

    Amen
     
    Shea Martin, Apr 8, 2004
    #7
  8. Shea Martin <> spoke thus:

    > (snip tons of irrelevant quoted text)


    > Amen


    That was a lot to "Amen". Please learn to quote judiciously. Thanks.

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, Apr 8, 2004
    #8
    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. Thomas Scheffler

    JAXP:SAX: EntityResolver never used

    Thomas Scheffler, Nov 12, 2003, in forum: XML
    Replies:
    0
    Views:
    650
    Thomas Scheffler
    Nov 12, 2003
  2. Soren Kuula
    Replies:
    1
    Views:
    490
    Henry S. Thompson
    Dec 1, 2005
  3. Kevin
    Replies:
    4
    Views:
    457
    Irrwahn Grausewitz
    Oct 17, 2003
  4. Hal Styli
    Replies:
    14
    Views:
    1,716
    Old Wolf
    Jan 20, 2004
  5. Replies:
    19
    Views:
    6,971
    Dan Pop
    May 25, 2004
Loading...

Share This Page