Re: Some pointer quiestions again



Mac <foo@xxxxxxx> wrote:
> On Tue, 31 May 2005 17:45:08 +0000, Jens.Toerring wrote:

> [snip]

>> [...] requiring that all pointer types
>> can be converted to and from a void pointer [...]

> Isn't this supposed to be all _object_ pointer types or something like
> that? What I am getting at is that ISTR that you cannot store a function
> pointer in a void pointer.

You're right, at last as far as I understand the standard only
conversion between object type pointers and a void pointer is
guaranteed to work. Allowing to convert between void and func-
tion pointers is listed as a "Common extension", so it's not
portable.
Regards, Jens
--
\ Jens Thoms Toerring ___ Jens.Toerring@xxxxxxxxxxxxxxxxxxx
\__________________________ http://www.toerring.de
.



Relevant Pages

  • Re: returning arguments
    ... You can carry any pointer type in that "void* container". ... The clause you point out is also valid, but generally of less concern because it applies only if you dereference the "not really a pointer" value. ... The problems come with WORD addressed machines that support a field-reference address format, meaning addresses are no longer simply byte indices; and changing pointer types might involve changes to the data. ...
    (comp.programming.threads)
  • Re: Alignment
    ... and consider the problems of converting ... between pointer types on such machines; ... A void* can be converted to any ...
    (comp.lang.c)
  • Re: function prototype vs function declaration
    ... voiding main and using gets seem to be distressingly common in real ... including a pointer to a function... ... Conversion between function and void pointer types is undefined. ...
    (comp.lang.c)
  • Re: Equivalent malloc with calloc
    ... Using an integer instead of a pointer may cause the compiler to issue ... fewer notices for conversions of NULL to non-void pointer types. ... violations because of poor style, which is of course the problem with ...
    (comp.lang.c)
  • Re: Hi-tech C libc _doprnt.c fprintf.c needed
    ... about pointers to functions passed as args?: ... ^ illegal conversion between pointer types (warning) ... Note that this warning always happens when passing a pointer-to- ... Basically you have to cast to a "generic" function pointer when you ...
    (comp.arch.embedded)