Re: Newbie Ques: ((void(*) (void *)) 0)



Desmond Foley <desie@xxxxxxxxxxxxxxxx> wrote:

> I now understand that
>
> (void(*) (void *))
>
> is a cast, and the cast is to a pointer to a function. That function has
> one argument, a pointer to a void, the function returns void.
>
> I think I can imagine how that applies if we were casting a function,
> but I am unclear as to what it means for a number to be casted into a
> function.

For any other number, it would mean nothing whatsoever.

However, the number in question was a literal 0. That's a null pointer
constant. Null pointer constants can be cast to function pointer type -
and the result is a null pointer of function pointer type. IOW, you get
a function pointer that explicitly points nowhere, just as (int *)0 is
an int pointer that points nowhere.

Richard
.



Relevant Pages