Re: Newbie Ques: ((void(*) (void *)) 0)
- From: rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos)
- Date: Tue, 07 Jun 2005 15:00:57 GMT
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
.
- References:
- Newbie Ques: ((void(*) (void *) 0)
- From: Desmond Foley
- Re: Newbie Ques: ((void(*) (void *)) 0)
- From: Desmond Foley
- Newbie Ques: ((void(*) (void *) 0)
- Prev by Date: Re: Underflow and floating-point math
- Next by Date: Hi.. Need immediate help
- Previous by thread: Re: Newbie Ques: ((void(*) (void *)) 0)
- Next by thread: ANCI C? What is that - a NASA invention?
- Index(es):
Relevant Pages
|