Re: null function pointer?



Chris Torek wrote:
>
> >> Keith Thompson <kst-u@xxxxxxx> writes:
> >> > There is no conversion, explicit or implicit,
> >> > defined between object pointers and function pointers
>
> >Tim Rentsch wrote:
> >> Technically not quite correct. The code
> >>
> >> int (*pf)(void);
> >>
> >> pf = (void*)0;
> >>
> >> converts an object pointer value to a function pointer.
> >> It's true, the object pointer expression in this
> >> case is also a null pointer constant,
> >> but the expression still yields a value of object pointer type,
> >> and that value is converted by the assignment.
>
> In article <434CC4D1.5A1B@xxxxxxxxxxxxxx>
> pete <pfiland@xxxxxxxxxxxxxx> wrote:
> >No.
> >(void *) is a pointer to an incomplete type,
> >not a pointer to an object type.
>
> Indeed, although "pointer to incomplete [data] type" could be
> considered a sub-group of "pointer to object type", or more
> generically, "data pointer" -- to be distinguished from "function
> pointer", a la Harvard architectures in general.

No.
In C, there's three kinds of types:
1 object
2 incomplete
3 function

What Keith Thompson wrote is just simply and completely
accurate and useful to know, as far as C is concerned.

--
pete
.



Relevant Pages

  • Re: Is this valid C statement?
    ... > pointer and an object pointer, even with an explicit cast, is allowed? ... > incomplete type and a pointer to a different object or incomplete ...
    (comp.lang.c)
  • Re: Garbage Collection in C
    ... since if the number of DLLs that the ... casting an object pointer to a pointer with a less strict alignment ... the result of converting a pointer ...
    (comp.lang.c)
  • Re: what is the this keyword
    ... What Patricia means is that when a compiler is reading the ... techniques can vary between compilers and Java virtual machines. ... along a pointer to the object as a sort of hidden parameter. ... Follow the object pointer, and look at a predetermined offset to ...
    (comp.lang.java.help)
  • Re: man malloc
    ... % foo.c:14: warning: ISO C forbids conversion of function pointer to object pointer type ...
    (freebsd-questions)
  • Re: Change a TextBox Font
    ... > I would suspect something is happening to corrupt the object pointer ... > you are passing then. ... I've run a test here using textboxes and ...
    (microsoft.public.vb.winapi)