[PATCH] D12747: Implement [depr.c.headers]

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 11:50:25 PDT 2015


On Tue, Oct 6, 2015 at 3:57 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> <stddef.h>. This one is tricky:
>
> 1) There's an (undocumented) interface between the C standard library and
> this header, where the macros __need_ptrdiff_t, __need_size_t,
> __need_wchar_t, __need_NULL, __need_wint_t request just a piece of this
> header rather than the whole thing. If we see any of those, just go
> straight to the underlying header.
>

Ok, but in that case we don't get nullptr.  I suspect that's OK.


> 2) We probably don't want <stddef.h> to include <cstddef> (for consistency
> with other headers)
>

No, we do not! :-)


> , but <stddef.h> must provide a ::nullptr_t (which we don't want <cstddef>
> to provide). So neither header includes the other. Instead, both include
> <__nullptr> for std::nullptr_t, and we duplicate the definition of
> max_align_t between them, in the case where the compiler's <stddef.h>
> doesn't provide it.
>
> If you prefer, I could make <stddef.h> include <cstddef> to avoid the
> duplication of the max_align_t logic.
>

No; this is a minor annoyance, and layer jumping (<stdXXX.h> including
<cstdXXX>) is a major annoyance - and I'm pretty sure that that would come
back to bite us in the future.

Looks ok to me.

-- Marshall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151008/356ba96d/attachment.html>


More information about the cfe-commits mailing list