[llvm] r193377 - lto.h: Use lto_bool_t instead of int to restore the ABI

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Oct 24 19:01:23 PDT 2013


On 24 October 2013 21:40, Sean Silva <silvas at purdue.edu> wrote:
> Did I miss something? What's wrong with `int`? This is a C API and using an
> int for a "status"/"boolean" is nonproblematic (even expected, I would say;
> all C API's use int's for statuses/booleans).

Yes, we should have been using int, but we were not and now we are
stuck with bool for ABI stability.

>This patch seems like needless
> hassle. Furthermore, conditionalizing the actual type seems likely to induce
> future changes to the meaning of this typedef, thus breaking ABI
> compatibility.
>
> Actually, bool has the "does true mean success or failure?" problem. With
> `int` you don't have this problem since it is either "status"/"errno"-ish (0
> is success, < 0 is error), like `stat` or a boolean-int (1 is true, 0 is
> false; this is built into the core language's boolean logical operators),
> and which it is is completely obvious from the function name (and of course,
> one can still refer to the function's documentation if need be).
>
> -- Sean Silva
>
>

Cheers,
Rafael



More information about the llvm-commits mailing list