Thread: Help...please help

  1. #16
    Registered User
    Join Date
    Oct 2004
    Posts
    76
    Wait are we talking C98, C99, or ISO standards?

  2. #17
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    C99 I presume.

  3. #18
    Registered User Sake's Avatar
    Join Date
    Jan 2005
    Posts
    89
    >>Yet the standard is clear that the ways to declare main are as the following
    You'll notice that it also provides for anything equivalent to the two definitions provided, which the section I quoted shows that
    Code:
    int main()
    {
      /* ... */
    }
    is equivalent.

    >>So why the fuss?
    It's a trivial matter, I agree, but I don't like everyone calling me wrong when I'm not.

    >>Wait are we talking C98, C99, or ISO standards?
    All of them. This is one rule that hasn't changed since C89.
    Kampai!

  4. #19
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Quote Originally Posted by Sake
    >>Yet the standard is clear that the ways to declare main are as the following
    You'll notice that it also provides for anything equivalent to the two definitions provided, which the section I quoted shows that
    Code:
    int main()
    {
      /* ... */
    }
    is equivalent.
    I think they are referring to the use of

    Code:
    int main(int argc char *argv[])
    being the same as

    Code:
    int main(int argc char **argv)
    and the like - that is what I gather from the footnote. But as to the form of main without command line arguments,

    5.1.2.2.1

    Program startup

    1 The function called at program startup is named main. The implementation declares no prototype for this function. It shall be defined with a return type of int and with no parameters:

    Code:
    int main(void) { /* ... */ }
    ~/
    Last edited by kermit; 02-13-2005 at 10:23 AM.

  5. #20
    Registered User Sake's Avatar
    Join Date
    Jan 2005
    Posts
    89
    Since your misunderstanding won't break anything, you can believe what you want to. But if you want to further your understanding of C, feel free to post the following question on comp.std.c.
    Code:
    What is the difference between
    
    int main()
    {
      return 0;
    }
    
    and
    
    int main(void)
    {
      return 0;
    }
    
    ?
    People who are much smarter than me (including those who actually helped write the standard) have debated this before and the consensus was that the two are valid, equivalent, and conforming.
    Kampai!

  6. #21
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    >>feel free to post the following question on comp.std.c.

    No thanks, I know how to browse usenet with Google, so I can look it up myself if I choose.

    Regarding misunderstanding - I guess those smart people who wrote the standard ought to polish it up a bit, particularly section 5.1.2.2.1 - that way people who are not smart, and cannot very well comprehend what they are reading in the standard, might have a better chance at learning something about the language. Perhaps you could post something like this to comp.std.c

    Hey smart people - please rewrite section 5.1.2.2.1 so it is more understandable.

    thanx
    Clear enough?

    ~/
    Last edited by kermit; 02-13-2005 at 11:18 AM.

  7. #22
    Registered User Sake's Avatar
    Join Date
    Jan 2005
    Posts
    89
    >>No thanks, I know how to browse usenet with Google, so I can look it up myself if I choose.
    But you choose not to because you still think you're right and I'm not? People here are almost as stubborn as I am.

    >>Clear enough?
    The standard was written to be precise for implementors, not comprehensible for the average programmer. If every little detail were explained then the standard would grow exponentially. To be perfectly frank, if you read it enough, you learn the writing style and it's easier to make sense of things. And of course, comp.std.c is a fine place to get clarification if there's any doubt.
    Kampai!

Popular pages Recent additions subscribe to a feed