[LLVMdev] LLD: Returning true on success

Rui Ueyama ruiu at google.com
Tue Sep 24 15:48:32 PDT 2013


It looks like although it's not mentioned in the coding standard, nobody is
opposing to invert it for this case, so I'll do it. I agree with Michael.
Returning true on success seems natural to me. However, I believe the most
important thing is to maintain consistency of boolean return value at
least within LLD whether it should be true or false.


On Tue, Sep 24, 2013 at 1:51 PM, Shankar Easwaran
<shankare at codeaurora.org>wrote:

> On 9/24/2013 2:33 PM, Rui Ueyama wrote:
>
>> Hi LLD developers,
>>
>> 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.
>>
> You have to be a bit careful here, as the return from parse is used as a
> exit code from lld.
>
> The Unix shell interprets 0 (false as success) as 1(true as failure).
>
> It has to be consistent throughout for this reason.
>
> As Bigcheese mentioned,  if its in the Coding standard this would really
> help.
>
> Thanks
>
> Shankar Easwaran
>
>
>> 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.
>>
>>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by the Linux Foundation
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130924/e8df7fa2/attachment.html>


More information about the llvm-dev mailing list