<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">- I personally prefer return `true` on success<div class="">- I'm pretty sure we have both in LLVM</div><div class="">- I think the 2nd version is more common in LLVM (though this is just my gut feeling and my be biased from the areas I work on).</div><div class=""><br class=""></div><div class="">I'd mainly try to stay consistent with the code you find in the area of LLVM you are working on...</div><div class=""><br class=""></div><div class="">- Matthias<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 17, 2018, at 10:57 AM, Nico Weber via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">in <a href="https://reviews.llvm.org/D52143" class="">https://reviews.llvm.org/D52143</a> there's some uncertainty if LLVM code prefers</div><div class=""><br class=""></div><div class="">  if (!Function())</div><div class="">    // Call to function failed, deal with it</div><div class=""><br class=""></div><div class="">or</div><div class=""><br class=""></div><div class=""><div class="">  if (Function())</div><div class="">    // Call to function failed, deal with it</div></div><div class=""><br class=""></div><div class="">(Note that this is about functions returning bool, not int.)<br class=""></div><div class=""><br class=""></div><div class="">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 codebase.</div><div class=""><br class="">True on success seems more common:</div><div class=""><a href="http://llvm-cs.pcc.me.uk/?q=true+on+success" class="">http://llvm-cs.pcc.me.uk/?q=true+on+success</a><br class=""></div><div class=""><a href="http://llvm-cs.pcc.me.uk/?q=true+on+error" class="">http://llvm-cs.pcc.me.uk/?q=true+on+error</a><br class=""></div><div class=""><br class=""></div><div class="">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 :-)</div><div class=""><br class=""></div><div class="">Apologies for the bike-sheddy topic.</div><div class=""><br class=""></div><div class="">Nico</div></div></div></div></div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>