Coding standard: return succ on failure?

Chandler Carruth chandlerc at google.com
Thu Aug 1 13:25:37 PDT 2013


I have lobbied in the past for doing away with returning false on success.
I continue to do so.

There are parts of the Clang parser that do this consistently, but they are
increasingly few and far between. I consistently see new code being written
in both Clang and LLVM using false to mean failure and true to mean
success, so I think we should just admit that this is the de-facto standard
for new code going forward.

That said, the last time I raised this question, Chris showed up to argue.
;]


On Thu, Aug 1, 2013 at 10:20 AM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:

> Hi, dear all:
>
>     I find some of the code (e.g. LTOCodeGenerator) in llvm return false
> on succ (we might as well
> return 0 on succ as with many C code0); this is very confusing,
> counter-intuitive, and error-prone.
> Things are even worse, if this piece of code call other modules with
> negated logic.
>
>     In what situation should we use this negated logic? Is it deprecated
> now?  Can we toggle the logic
> to the way we would normally take for granted?
>
> Thanks in advance!
> A senior newbie (just brazenly promote myself)
> ______________________________**_________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/llvm-commits<http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130801/cb1ae2c8/attachment.html>


More information about the llvm-commits mailing list