mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-26 04:51:43 +00:00
Add macro to cast function pointer to void pointer
Does not evaluate constant expression, I don't know if that's possible.
This commit is contained in:
parent
bef9f502ca
commit
9722027fc1
1 changed files with 8 additions and 0 deletions
|
|
@ -409,4 +409,12 @@ typedef UINT64 precise_t;
|
|||
#define intsign(n) \
|
||||
((n) < 0 ? -1 : (n) > 0 ? 1 : 0)
|
||||
|
||||
// ISO C forbids function pointer -> void pointer cast but
|
||||
// if it's wrapped in a struct, we can take a pointer to
|
||||
// that struct and it's fine...
|
||||
|
||||
// Cast function pointer to (void*)
|
||||
#define FUNCPTRCAST(p) ((union{void(*f)(void);void*v;})\
|
||||
{(void(*)(void))p}).v
|
||||
|
||||
#endif //__DOOMTYPE__
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue