<div dir="ltr">Okay after translating the headers to Delphi, i found more inconsistencies:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,<br> LLVMTypeRef *ParamTypes, unsigned ParamCount,<br> LLVMBool IsVarArg);<br></blockquote><div><br></div><div>In this case it is the other way around. 0 means False and anything else means true :/ (so it acts more like a "traditional" bool) <br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-12 11:17 GMT+02:00 Alexander Benikowski <span dir="ltr"><<a href="mailto:sebal007@googlemail.com" target="_blank">sebal007@googlemail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Of course, this is normal for C-APIs. But maybe change the name to LLVMResult to propagate the real use? I am not arguing about the results themself. They are standard. But the name is missguiding. As long as it's consistent i know that i have to write an extra record operator in Delphi to reflect this.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2016-09-12 11:11 GMT+02:00 David Chisnall <span dir="ltr"><<a href="mailto:David.Chisnall@cl.cam.ac.uk" target="_blank">David.Chisnall@cl.cam.ac.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 12 Sep 2016, at 09:59, Alexander Benikowski via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> I stumbled across the following:<br>
> /* Builds a module from the bitcode in the specified memory buffer, returning a<br>
> reference to the module via the OutModule parameter. Returns 0 on success. */<br>
> LLVMBool LLVMParseBitcode2(LLVMMemoryBu<wbr>fferRef MemBuf,<br>
> LLVMModuleRef *OutModule);<br>
> However in most scenarios i know, a Bool is something like<br>
> 0 = False<br>
> !0 = True<br>
><br>
> In short: is it just me or is this really counterintuitive?<br>
<br>
</span>It is counterintuitive, but it is also consistent with a lot of C APIs (including most of the standard library). Returning 0 on success and non-zero on failure is a very common idiom in C. The rationale is that you can write:<br>
<br>
int ret;<br>
if ((ret = some_function()))<br>
// Error handling<br>
<br>
and that ret will contain a meaningful error code on return (the latter is missing when you use a boolean type).<br>
<span class="m_4216618199564397696HOEnZb"><font color="#888888"><br>
David<br>
<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>