<div dir="ltr">On Tue, Sep 24, 2013 at 2:40 PM, Michael Spencer <span dir="ltr"><<a href="mailto:bigcheesegs@gmail.com" target="_blank" class="cremed">bigcheesegs@gmail.com</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div><div class="h5"><div>On Tue, Sep 24, 2013 at 12:33 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank" class="cremed">ruiu@google.com</a>></span> wrote:<br>
</div></div></div><div class="gmail_quote"><div><div class="h5">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hi LLD developers,</div><div><br></div>

<div>I'm about to make a change to invert the return value of Driver::parse() to return true on success. Currently it returns false on success.</div><div><br></div>

<div>In many other functions, we return true to indicate success and false to indicate failure. The inconsistency is confusing, and fixing it should improve code readability.</div><div><br></div></div></blockquote><div><br>

</div></div></div><div>Note that some places in LLVM use false to indicate success, not sure how widespread this is. Personally I think that { if (doSomething()) } means if doSomething succeeded, and thus agree with you. However, I think this is something that needs to be consistent across all of LLVM and should be in the coding standard.</div>
</div></div></div></blockquote><div><br></div><div>Yes, this comes up again and again.</div><div><br></div><div>Chris has argued for true-on-error before as it fits with the classical pattern of integer or enum error codes, but recently has indicated a willingness to shift this stance.</div>
<div><br></div><div>What makes sense to me is to give 3 possible choices:</div><div><br></div><div>1) bool return, true indicates success.</div><div><br></div><div>2) an enum with a success enumerator which == 0, and non-success error codes != 0.</div>
<div><br></div><div>3) an error class with an operator bool where true indicates the class does contain an error.</div><div><br></div><div><br></div><div>It is only #3 and #1 that then are in any real contradiction at that point, and it seems easy to understand and explain due to the object being an error object. </div>
</div></div></div>