<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jun 14, 2015 at 12:59 PM, Jonathan Schleifer <span dir="ltr"><<a href="mailto:js@webkeks.org" target="_blank">js@webkeks.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Am 14.06.2015 um 21:39 schrieb Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>>:<br>
<br>
> __nonnull is defined as a function-like macro, so any use that is not followed by a ( will work fine. That makes the portability problem significantly less severe.<br>
<br>
</span>Hm, indeed, weird. I got some errors about not giving it enough arguments, however, I can't reproduce what I did there.<br>
<span class=""><br>
> That seems like an odd way to deal with that portability problem. The conventional way is:<br>
><br>
<br>
> #if __has_feature(nullability)<br>
> #define NONNULL __nonnull<br>
> #else<br>
> #define NONNULL<br>
> #endif<br>
><br>
> ... which again works without problems so long as you don't follow NONNULL with a left parenthesis.<br>
<br>
</span>I disagree about this being odd. As a counter example, restrict was added in C99. #define restrict was a very common thing to make sure it still compiles as C89.<br></blockquote><div><br></div><div>Well, 'restrict' was not a reserved identifier in C89. __nonnull is a reserved identifier in all C-family languages. But you're right, some people might be #defining __nonnull themselves, and if they do, their code will be non-portable.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As for using a hack with a define, this is what I did for now. Still, it's a hack and makes all declarations look ugly and weird. Wouldn't it be much nicer to have a keyword that you can just define to nothing for backwards compatibility, like with restrict? (That does not mean we can't keep __nonnull in addition to another name on OS X / iOS, so it would not break any existing code).<br></blockquote><div><br></div><div>I don't think that using two separate reserved identifiers for this keyword is really much nicer than using one. If we could use a 'prettier' keyword for this, like "nonnull", that might be nicer, but we really don't want Clang to introduce its own non-conforming language mode like that. But you can create this state of affairs yourself with a #define.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I wonder if it makes sense to bring up this issue with the glibc maintainers as well? </blockquote></div></div></div>