add a simple sizeof checker to compare nim & c types
This commit is contained in:
parent
ee8c1c6f93
commit
be1e3c4e09
2 changed files with 12 additions and 1 deletions
|
|
@ -459,3 +459,11 @@ typedef int Nim_and_C_compiler_disagree_on_target_architecture[sizeof(NI) == siz
|
|||
#elif defined(__FreeBSD__)
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Compile with -t:-DNIM_CHECK_ABI to enable */
|
||||
#ifdef NIM_CHECK_ABI
|
||||
# define NIM_CHECK_SIZE(typ, sz) \
|
||||
_Static_assert(sizeof(typ) == sz, "Nim & C disagree on type size")
|
||||
#else
|
||||
# define NIM_CHECK_SIZE(typ, sz)
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue