[cfe-dev] C++ Annex K safe C11 functions

Jonny Grant via cfe-dev cfe-dev at lists.llvm.org
Fri Jan 4 01:35:47 PST 2019


Thank you for your reply Richard.

On 03/01/2019 22:04, Richard Smith wrote:
> On Thu, 3 Jan 2019 at 13:44, Jonny Grant via cfe-dev 
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> 
>     Hello
> 
>     This file lists part of Annex K  "stdint.h"
>     https://clang.llvm.org/doxygen/stdint_8h_source.html
> 
>     But main C++ page doesn't mention Annex K. Is Annex K really fully
>     supported?
> 
> 
> That's generally not up to us; that's part of the C standard library, 
> not part of the compiler.
> 
> The one part of Annex K that *is* part of the compiler, according to the 
> usual division of responsibilities, wherein the compiler provides the 
> freestanding headers and the C standard library provides the rest, is 
> the definition of rsize_t in <stddef.h> and the definition of RSIZE_MAX 
> in <stdint.h>, and Clang provides those if __STDC_WANT_LIB_EXT1__ is 
> defined. However, we do not define __STDC_LIB_EXT1__ because, as noted, 
> that's not up to us, and we have no idea what your C standard library 
> supports.

I use glibc, it doesn't support Annex K. We are keen to use Annex K 
functionality, so looking around for options.

Do you know if Clang has any intention to develop support for a libc C11 
with Annex K Support?


I'm looking around, and came across this project
https://github.com/rurban/safeclib/blob/master/README


> So in that sense, we implement the part of Annex K that is in our domain.
> 
>     Some background
>     https://clang.llvm.org/compatibility.html
>     https://clang.llvm.org/cxx_status.html
> 
> 
> I'm not sure what these are supposed to show: Annex K is optional in C, 
> and not part of C++.

It would be good if what you state could be added to the compatibility 
page, that Annex K is supported only for stdint.h, but that clang 
requires a libc which supports C11 Annex K functions/implementation.

Cheers, Jonny





More information about the cfe-dev mailing list