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

Nico Weber via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 17 10:57:40 PDT 2018


in https://reviews.llvm.org/D52143 there's some uncertainty if LLVM code

  if (!Function())
    // Call to function failed, deal with it


  if (Function())
    // Call to function failed, deal with it

(Note that this is about functions returning bool, not int.)

Folks on that review feel that returning true on success is probably what
we want, but it's not documented anywhere and we do have both forms in the

True on success seems more common:

Does anyone have a pointer to previous on-list discussion on this? If not,
this thread could be the place where we sort this out once and for all :-)

Apologies for the bike-sheddy topic.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180917/b2502481/attachment.html>

More information about the llvm-dev mailing list