Re: function prototype vs function declaration



santosh <santosh.k83@xxxxxxxxx> writes:
Ravishankar S wrote:
[...]
If I am not mistaken a void* must be capabale of storing any pointer
(generic pointer) including a pointer to a function...

No. A void pointer can only store pointers to object and incomplete
types. Conversion between function and void pointer types is undefined.
Also there is no "generic" function pointer type.

There is no signle "generic" function pointer type. On the other
hand, *any* function pointer type (such as void (*)(void)) may be used
as a generic function pointer type. (It's generic in the sense that
you can losslessly convert any function pointer to and from it; unlike
with void*, such conversions require explicit casts.)

--
Keith Thompson (The_Other_Keith) <kst-u@xxxxxxx>
Looking for software development work in the San Diego area.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.



Relevant Pages

  • Re: Some pointer quiestions again
    ... A function pointer can be converted to a void pointer but ... You can do the conversion with a cast: ... >void pointer reliably, if not then there would appear to be no portable ...
    (comp.lang.c)
  • function pointers and null pointers
    ... From the C99 standard it results that a void pointer can be converted ... exclude the conversion of a void pointer to/from a function pointer. ...
    (comp.std.c)
  • Re: Function Pointers
    ... any function pointer type can be converted to any other function pointer type and back, without loss of information. ...
    (comp.lang.c)
  • Re: What is a null pointer constant?
    ... >>> What is a null pointer constant? ... > needed is a function pointer type, ... I believe Comeau and Tendra are in error when they reject the ...
    (comp.std.c)
  • Re: *generic* pointer to function(s)?
    ... prototypes and deciding, by setting a pointer, which of ... The most common generic function pointer type ...
    (comp.lang.c)