12.3.2 Other foreign interface types
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • Interface Data Types
          • Other foreign interface types
            • PL_ARITY_AS_SIZE
    • Packages

12.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. Up to 8.1.28, the default was to use the old int functions. As of 8.1.29/8.2.x, the default is to use size_t and the old behaviour can be restored by defining PL_ARITY_AS_SIZE to 0 (zero). This makes old code compatible, but the following warning is printed when compiling:

#warning "Term arity has changed from int to size_t."
#warning "Please update your code or use #define PL_ARITY_AS_SIZE 0."

To make the code compile silently again, change the types you use to represent arity from int to size_t. Please be aware that size_t is unsigned. At some point representing arity as int will be dropped completely.