Am 07.05.21 um 11:50 schrieb Павел Бельтюков:
> Hi, Philipp
> 
>     Using the normal C syntax.
>     Function pointers are always 24 bits in the large model, while they are
>     always 16 bits in the medium model.
>     Thus, you can't just link files compiled using the medium model with
>     files compiled using the large model.
> 
> 
> OK, then how do I cast a function pointer to void * and backward?
> 
> Best regards,
> Paul Beltyukov

You don't.

The C standard (unlike POSIX¹) does not require C implementations to
support casts between function pointers and void *, though this feature
is mentioned as a common extension in the non-normative Annex J.5.7.

If you need a type that can hold a pointer to anything (object or
function), a union could be an option.

Philipp

¹ I haven't checked the POSIX stanard now, but AFAIR, while POSIX still
allows such casts, it is considered an obsolescent feature there.


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to