Re: struct and function-pointer casting
- From: Maurice <mauricex@xxxxxxx>
- Date: Sat, 30 Apr 2005 20:38:58 +0200
Eric Sosman <eric.sosman@xxxxxxx> wrote:
> No; the type of `derived_func' does not match the
> type of the `func' element in `struct Base', so the
> compiler should object to the initialization. One
> simple fix is
>
> void derived_func(struct Base *b) {
> struct Derived *d = (struct Derived*)b;
> ...
> }
Ok, not as neat as it would be in my code but I think I can
live with it.
> The conversions of the struct pointers are all right:
> any struct pointer can be converted to and from a pointer
> to the struct's first element (unless that element is a
> bit-field; you can't point to a bit-field).
That is good.
Thanks for your answer.
.
- References:
- struct and function-pointer casting
- From: Maurice
- Re: struct and function-pointer casting
- From: Eric Sosman
- struct and function-pointer casting
- Prev by Date: Re: two dimensional arrays:
- Next by Date: Re: a few doubts!
- Previous by thread: Re: struct and function-pointer casting
- Next by thread: main(int argc, char *argv[])
- Index(es):
Relevant Pages
|