biotomas / ipasir

The Standard Interface for Incremental Satisfiability Solving
Other
47 stars 14 forks source link

Replace usage of int with int32_t where it denotes the type of a literal #18

Closed Robbepop closed 4 years ago

Robbepop commented 4 years ago

Currently IPASIR uses int whenever it denotes the type of a literal.

Problem

This generally is not FFI friendly since int does not have a fixed size and could theoretically be anything between 16-bit to 64-bit. Practically it is 32-bit on most platforms but there is no guarantee.

If two programs compiled with different assumptions for the size of int were to communicate with each other over the IPASIR interface this would lead to failure. Changing int to int32_t should not break IPASIR users since most (if not all) production ready solvers use 32-bit integers for their literal representation anyways. With this PR this information is now also encoded.

Future Enhancementss

Even though it would make sense for IPASIR to only use fixed-sized integer types in general I did not replace any other types since the literal type notation is the most important at this point and also I wanted to keep the PR small and contained.

Downsides


My personal motivation for this to be merged is that I would feel far more confident with my IPASIR bindings from another language.