11.3.2.1 PL_ARITY_AS_SIZE
As of SWI-Prolog 7.3.12, the arity of terms has changed from int
to size_t
. To deal with this transition, all affecting
functions have two versions, where the old name exchanges the arity as int
and a new function with name *_sz() exchanges the arity as
size_t
. If the C macro PL_ARITY_AS_SIZE is defined before
loading SWI-Prolog.h
, macros are put in place that map the
old names to the new functions. Without precautions, the old code is
compatible, but the following warning is printed when compiling:
#warning "Term arity has changed from int to size_t." #warning "Please update your code and use #define PL_ARITY_AS_SIZE 1."
To make the code compile silently again, include SWI-Prolog.h
as below and change the types you use to represent arity from int
to size_t
. Please be aware that size_t
is
unsigned.
#define PL_ARITY_AS_SIZE #include <SWI-Prolog.h>