Re: function prototype vs function declaration
- From: santosh <santosh.k83@xxxxxxxxx>
- Date: Tue, 18 Dec 2007 18:41:24 +0530
Ravishankar S wrote:
"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message
news:S4adnVMRZ6GnJvranZ2dnUVZ8qGdnZ2d@xxxxxxxxx
Ravishankar S said:
<snip>
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.
I think you should stop writing tutorials and start reading them.
There is a very important distinction between a declaration and a
prototype, and you do your readers a disservice by not making the
distinction clear.
I am making that distinction.Its only the perception that differs. I
was infact wondering whether I should make that
sentence ("there is a minor yet important difference between function
declaration and function prototype"). But I changed
since I have to make its importance clear.
I am sure 90/100 C progrmmers are not aware of this distiction given
now that function
prototypes are common.
However it is better to accurately explain the language as it is
formalised rather than as it might be commonly used. Flushing stdin,
voiding main and using gets seem to be distressingly common in real
world usage, but a tutorial that uses them other than to describe their
dangers, would be considered of very low quality.
What's more, there are (rather recondite) circumstances where youI was thinking that my conclusions are fairly accurate!
could conceivably need to eschew the prototype form - I'm thinking
particularly of arrays of pointer to function where not all the
functions have the same type. It is important to know when to use the
prototype form (i.e. nearly always) and when it *might* be a good
idea not to.
But I cannot help but note that what you have mentioned may also be
achieved by using void pointer's.
No. void pointers are quite different from function pointers. Please
read a good textbook before continuing on your tutorial.
.
- Follow-Ups:
- Re: function prototype vs function declaration
- From: Ravishankar S
- Re: function prototype vs function declaration
- 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
- Re: function prototype vs function declaration
- From: Richard Heathfield
- 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: object file size is reduced after build
- Previous by thread: Re: function prototype vs function declaration
- Next by thread: Re: function prototype vs function declaration
- Index(es):
Relevant Pages
|