Re: function prototype vs function declaration



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.

What's more, there are (rather recondite) circumstances where you 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.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: prototypes are useless?
    ... David White wrote: ... But it isn't a prototype. ... C has function declarations ... In C++ there's no distinction to draw, ...
    (alt.comp.lang.learn.c-cpp)
  • Re: function prototype vs function declaration
    ... you do your readers a disservice by not making the distinction clear. ... declaration and function prototype"). ... It is important to know when to use the prototype form (i.e. nearly ...
    (comp.lang.c)
  • Re: Endless loop question
    ... > In this case, though, the distinction doesn't make any difference; ... > means "Here's the definition of a function called main, returning int ... with a prototype". ... So why not give the compiler all the information you have? ...
    (comp.lang.c)