[cfe-dev] Implementation of stddef.h
Eli Friedman
eli.friedman at gmail.com
Sun May 18 15:28:22 PDT 2008
On Sun, May 18, 2008 at 2:47 PM, Neil Booth <neil at daikokuya.co.uk> wrote:
> Eli Friedman wrote:-
>
>> Should I take the fact that there have been no comments as meaning the
>> patch is bad, the patch is okay, or just that nobody with the
>> appropriate expertise had the time to take a look at it?
>
> My only concern would be that for
>
> typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t;
>
> I don't think subtracting NULL pointers is well-defined. That doesn't
> matter as long as clang doesn't complain about it and does what you
> expect though.
clang doesn't complain about it, and appears to work properly. On a
side note, the C++ standard actually explicitly defines that
((int*)0)-((int*)0) is valid compares equal to 0.
-Eli
More information about the cfe-dev
mailing list