[llvm-dev] [cfe-dev] Should functions returning bool return true or false on success?

Chandler Carruth via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 19 17:47:57 PDT 2018


On Wed, Sep 19, 2018 at 3:22 PM Krzysztof Parzyszek via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> On 9/19/2018 5:04 PM, James Courtier-Dutton via llvm-dev wrote:
> > I would take the opinion that the code should be self documenting.
> > So, based on the function name, it should be obvious which it is.
>
> So "analyzeBranch" returns "true" or "false" on failure? And if it's not
> obvious, does it mean that the name is wrongly chosen?
>

There are a host of issues with `analyzeBranch`'s interface. They defy
description.

Let's start with the fact that it *mutates the branch*.


>
> -Krzysztof
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180919/7e9398d1/attachment.html>


More information about the llvm-dev mailing list