Re: Endless loop question
From: Flash Gordon (spam_at_flash-gordon.me.uk)
Date: 09/29/04
- Next message: Mark A. Odell: "Re: Endless loop question"
- Previous message: Keith Thompson: "Re: Trying to understand pointers for function paramaters"
- Next in thread: Mark A. Odell: "Re: Endless loop question"
- Maybe reply: Mark A. Odell: "Re: Endless loop question"
- Maybe reply: Alan Balmer: "Re: Endless loop question"
- Maybe reply: Alan Balmer: "Re: Endless loop question"
- Reply: Dave Vandervies: "Re: Endless loop question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Sep 2004 20:19:13 +0100
On Wed, 29 Sep 2004 18:30:11 +0000 (UTC)
dj3vande@csclub.uwaterloo.ca (Dave Vandervies) wrote:
> In article <07vll0dmhqi8mgikmh7gtdk1qs1crqqk0s@4ax.com>,
> Alan Balmer <albalmer@spamcop.net> wrote:
> >On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu.edu.pl> wrote:
> >
> >>Mark A. Odell <odellmark@hotmail.com> wrote:
> >>> phaza7@yahoo.com (Tweaxor) wrote in
> >>> news:1c0c25ba.0409290912.14fefb61@posting.google.com:
> >>
> >>> > int main() {
> >>> Ick ^^^^^^^^
> >>
> >>> int main(void)
> >>> {
> >>
> >>No, why? You can drop `void' in function definition, can't you?
> >
> >They mean different things. '(void)' tells the compiler there are no
> >arguments. '()' tells the compiler that the arguments are
> >unspecified.
>
> In this case, though, the distinction doesn't make any difference; one
> form means "Here's the definition of a function called main, returning
> int and taking no arguments, without a prototype" and the other form
> means "Here's the definition of a function called main, returning int
> and taking no arguments, with a prototype".
So why not give the compiler all the information you have? It's
generally a good habit and if you[1] break it for main you are likely to
break it for other functions.
> Unless, of course, you're planning on calling main later on with a
> nonempty argument list. But if you really want to lie to the
> compiler, a prototype won't stop you either.
Actually, if there is a prototype in scope and you pass an incorrect
number of parameters the compiler is (I believe) *required* to produce a
diagnostic.
[1] The generic you, not the specific you.
-- Flash Gordon Sometimes I think shooting would be far too good for some people. Although my email address says spam, it is real and I read it.
- Next message: Mark A. Odell: "Re: Endless loop question"
- Previous message: Keith Thompson: "Re: Trying to understand pointers for function paramaters"
- Next in thread: Mark A. Odell: "Re: Endless loop question"
- Maybe reply: Mark A. Odell: "Re: Endless loop question"
- Maybe reply: Alan Balmer: "Re: Endless loop question"
- Maybe reply: Alan Balmer: "Re: Endless loop question"
- Reply: Dave Vandervies: "Re: Endless loop question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|