Re: function prototype vs function declaration
- From: George Peter Staplin <georgepsSPAMMENOT@xxxxxxxxxxxx>
- Date: Wed, 19 Dec 2007 01:42:25 +0000 (UTC)
Ravishankar S wrote:
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.
Point taken. Though this not of the same stature are of writing "void main"
and "fflush(stdin)".
I was thinking that my conclusions are fairly accurate!
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.
Please recommend me a good book, other than K&R which covers these points.
Thank you.
If I am not mistaken a void* must be capabale of storing any pointer
(generic pointer) including
a pointer to a function...
Unfortunately that's not true, and there is a correction for K&R
regarding that. I have a printing of the 2nd edition with that mistake.
"On page 199, beginning of §A6.8, ``Any pointer may be converted to type
void *...'' is changed to ``Any pointer to an object may be converted to
type void *...''." --
http://cm.bell-labs.com/cm/cs/cbook/2ediffs.html
While the C standard is limited in that way, the fact is most popular
systems *do* store function pointers in void *. POSIX is one example,
with regard to the way dlsym works(), and Windows is another.
C isn't very useful without other standards, and some of them conflict.
POSIX for instance makes certain restrictions for pthreads that limit
the optimizations that some compilers may do for C.
George
.
- 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
- 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: c calling c++ functions
- 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
|