<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">>> I'm not saying that the recommendation would change, but `long` being<br>
>> pointer-sized is a pretty universal assumption on Darwin, I'm afraid.<br>
><br>
><br>
> In the review I also said I’d update the documentation once this issue is<br>
> resolved:<br>
><br>
> <a href="https://reviews.llvm.org/D42933#1091502" rel="noreferrer" target="_blank">https://reviews.llvm.org/D42933#1091502</a><br>
<br>
Yes, but maybe that would be an update in the wrong direction? The<br>
current documented advice of casting to long and printing with %zd<br>
seems more correct maybe</blockquote><div><br></div><div><span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I think you had a typo there, the actual recommendation is to cast to long and print with %ld", not %zd.</span></div><div><br></div><div>I agree, changing Apple's documentation to _recommend_ using %zd, with a mismatched type, would be an unfortunate update. The docs are definitely more correct as they stand. Using the wrong format specifier for the type you passed would still be wrong, even on darwin, even though NSInteger and size_t are always the same size -- if they're different types, they're different types, and therefore, it's "technically" a mismatched specifier. That is what the warning is telling you, and it's right about that.</div><div><br></div><div>It's not a "false positive", it's just that it's telling you an annoying detail which (at least in many cases) is arguably not worth spending any time on fixing.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> In the very specific case of NSInteger and %z on Darwin platforms, do we</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> agree there’s no correctness issue? I’m not talking standards correctness,<br>
> I’m talking “the code does what’s expected”.<br>
<br>
But shouldn't the warnings usually hold the code to a higher standard<br>
than "does what's expected"</blockquote><div><br></div><div>Yes, often so. That said, "your code is technically incorrect, but will work anyways" is of course less important than "your code is very likely to be busted". Sometimes both are considered useful enough to end up in the default warnings set. Sometimes not. I think this situation could go either way. I'm on the "not worth warning by default" side, but, not firmly. <span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Just having some -Wno* available would be great already.</span></div><div><br></div></div></div>