Small changes in casts from void* to functions
Macro moved to llimits.h, and casts from void* to lua_CFunction first go through 'voidf' (a pointer to a function from void to void), a kind of void* for functions.
This commit is contained in:
20
llimits.h
20
llimits.h
@@ -152,6 +152,26 @@ typedef LUAI_UACINT l_uacInt;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Special type equivalent to '(void*)' for functions (to suppress some
|
||||
** warnings when converting function pointers)
|
||||
*/
|
||||
typedef void (*voidf)(void);
|
||||
|
||||
|
||||
/*
|
||||
** Macro to convert pointer-to-void* to pointer-to-function. This cast
|
||||
** is undefined according to ISO C, but POSIX assumes that it works.
|
||||
** (The '__extension__' in gnu compilers is only to avoid warnings.)
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
#define cast_func(p) (__extension__ (voidf)(p))
|
||||
#else
|
||||
#define cast_func(p) ((voidf)(p))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** non-return type
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user