Re: function prototype vs function declaration
- From: santosh <santosh.k83@xxxxxxxxx>
- Date: Tue, 18 Dec 2007 18:34:55 +0530
Ravishankar S wrote:
"santosh" <santosh.k83@xxxxxxxxx> wrote in message
news:fk89fa$tmr$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ravishankar S wrote:
"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message
news:eNWdnUUdru5UPvranZ2dnUVZ8qXinZ2d@xxxxxxxxx
Ravishankar S said:
<snip>
It turns out that function
declarations and function prototypes are the same thing in
standard C.
No, it doesn't.
It is true that all function prototypes are function declarations,
but it is not true that all function declarations are function
prototypes.
<snip>
an example would help here.
int fx();
This is a function declaration, but not a prototype. In fact,
argument checking is turned of for functions declared like this. This
is for backwards compatibility and not recommended for new code. Use:
int fx(void);
or specify the parameters explicitly, as a prototype.
Thanks.
My amended article would be:
It turns out that there is no difference between function declarations
and function prototypes as far as modern use of C is concerned.
No. With well written programs there prototypes may serve as
declarations, but this is by no means guaranteed. Saying "no
difference..." is too simplistic.
<snip>
ANSI C mandates function prototypes as the method for function
declaration.
Recommends, but not mandates.
.
- Follow-Ups:
- References:
- function prototype vs function declaration
- From: Ravishankar S
- Re: function prototype vs function declaration
- From: Richard Heathfield
- Re: function prototype vs function declaration
- From: Ravishankar S
- Re: function prototype vs function declaration
- From: santosh
- Re: function prototype vs function declaration
- From: Ravishankar S
- function prototype vs function declaration
- Prev by Date: Re: function prototype vs function declaration
- Next by Date: Re: function prototype vs function declaration
- Previous by thread: Re: function prototype vs function declaration
- Next by thread: Re: function prototype vs function declaration
- Index(es):
Relevant Pages
|