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

Sean Silva silvas at purdue.edu
Fri Oct 25 11:10:07 PDT 2013


On Thu, Oct 24, 2013 at 10:01 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> 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.
>

Ah, that makes perfect sense!

-- Sean Silva


>
> >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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131025/bd7d49b4/attachment.html>


More information about the llvm-commits mailing list