<div><div><div dir="auto">If someone is passing a uint64 when size_t is already smaller than uint64, that already seems like a bug, which the user should fix at compile time with an explicit cast.  It seems like preprocessor logic here is trying to turn a compile time problem into a runtime problem.  Feel free to wait for other opinions but personally I'd at *least* assert instead of just returning an error code</div></div></div><div><div><br><div class="gmail_quote"><div>On Thu, Sep 21, 2017 at 7:36 AM Roman Lebedev via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">lebedev.ri added a comment.<br>
<br>
On Thu, Sep 21, 2017 at 5:25 PM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<br>
<br>
> No, I just fail. I somehow thought the check was against the Offset<br>
>  parameter.<br>
><br>
> Is changing the function to take a size_t an option?<br>
<br>
We certainly could do that. But then, if `size_t` is *not* as large as `uint64_t`,<br>
when someone passes `uint64_t` value into the constructor, it will be either<br>
silently truncated, or there will only be a compile-time warning about truncation...<br>
I'd say that is worse than this preprocessor magic?<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D38132" rel="noreferrer" target="_blank">https://reviews.llvm.org/D38132</a><br>
<br>
<br>
<br>
</blockquote></div></div></div>