[libcxx] What C standard is assumed in libcxx?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[libcxx] What C standard is assumed in libcxx?

Neil Nelson via cfe-dev
Hi All,

libc++ assumes an underlying C library to provide lower level functionalities (and sometimes even other libraries like pthreads).

My question is, is there a minimum C standard required from the C library? I couldn't find this documented anywhere.

For example, the current std::thread support (C++11) does not assume the underlying C library to be C11 compliant, it instead depends on pthreads. On the other hand, we do seem to assume a C11 compliant <ctime> header (e.g. timespec).

This works OK for us at the moment (bits of C11 but mostly C99), but I'd like to get the general policy towards the C standard clarified.

I plan to update http://libcxx.llvm.org/index.html with the outcome of this discussion.

Thanks!

/ Asiri

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libcxx] What C standard is assumed in libcxx?

Neil Nelson via cfe-dev
On Wed, May 25, 2016 at 10:46:03AM +0100, Asiri Rathnayake via cfe-dev wrote:
> For example, the current std::thread support (C++11) does not assume the
> underlying C library to be C11 compliant, it instead depends on pthreads.
> On the other hand, we do seem to assume a C11 compliant <ctime> header
> (e.g. timespec).

I think you are confusing C11 functionality with basic POSIX functions.
While C11 might have merged a bunch of things from POSIX, things like
timespec are much older and wildly supported. That's unlike C11
threading for example.

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libcxx] What C standard is assumed in libcxx?

Neil Nelson via cfe-dev
OK, that makes sense.

So, libc++ essentially assumes C99 + some POSIX extensions like pthreads et. al.

Is it OK to assume that libc++ will not depend on C11 functionality in future?

Thanks!

/ Asiri


On Wed, May 25, 2016 at 3:10 PM, Joerg Sonnenberger via cfe-dev <[hidden email]> wrote:
On Wed, May 25, 2016 at 10:46:03AM +0100, Asiri Rathnayake via cfe-dev wrote:
> For example, the current std::thread support (C++11) does not assume the
> underlying C library to be C11 compliant, it instead depends on pthreads.
> On the other hand, we do seem to assume a C11 compliant <ctime> header
> (e.g. timespec).

I think you are confusing C11 functionality with basic POSIX functions.
While C11 might have merged a bunch of things from POSIX, things like
timespec are much older and wildly supported. That's unlike C11
threading for example.

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libcxx] What C standard is assumed in libcxx?

Neil Nelson via cfe-dev

std::atomic is implemented in terms of the C11 _Atomic feature.  That's a language feature though, and not a library feature.  I think you are mostly concerned with the library features needed.

I've had success with a C99 Dinkumware library.  I think the backing source predates C11.  I've had to do a fair amount on the pthread and posix side of things.

To be honest though, I don't know that it is entirely productive to list out the dependencies in as abstract a form as "C99 compliant + POSIX 20xx compliant".  In practice, libcxx and libcxxabi are developed against specific OSes and specific C libraries.  Support is added for those platforms.  GLIBC, MUSL, UCLIBC, NEWLIB, and a bunch of other C libraries all claim support for C99, but there tends to be little warts in each library that requires libcxx intervention.

On 5/25/2016 9:15 AM, Asiri Rathnayake via cfe-dev wrote:
OK, that makes sense.

So, libc++ essentially assumes C99 + some POSIX extensions like pthreads et. al.

Is it OK to assume that libc++ will not depend on C11 functionality in future?

Thanks!

/ Asiri


On Wed, May 25, 2016 at 3:10 PM, Joerg Sonnenberger via cfe-dev <[hidden email]> wrote:
On Wed, May 25, 2016 at 10:46:03AM +0100, Asiri Rathnayake via cfe-dev wrote:
> For example, the current std::thread support (C++11) does not assume the
> underlying C library to be C11 compliant, it instead depends on pthreads.
> On the other hand, we do seem to assume a C11 compliant <ctime> header
> (e.g. timespec).

I think you are confusing C11 functionality with basic POSIX functions.
While C11 might have merged a bunch of things from POSIX, things like
timespec are much older and wildly supported. That's unlike C11
threading for example.

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libcxx] What C standard is assumed in libcxx?

Neil Nelson via cfe-dev
Thanks Ben.

Yes, my concern is about library features. As long as libcxx does not assume C11 (or later) library features, we are mostly OK :)

/ Asiri 

On Wed, May 25, 2016 at 6:58 PM, Craig, Ben via cfe-dev <[hidden email]> wrote:

std::atomic is implemented in terms of the C11 _Atomic feature.  That's a language feature though, and not a library feature.  I think you are mostly concerned with the library features needed.

I've had success with a C99 Dinkumware library.  I think the backing source predates C11.  I've had to do a fair amount on the pthread and posix side of things.

To be honest though, I don't know that it is entirely productive to list out the dependencies in as abstract a form as "C99 compliant + POSIX 20xx compliant".  In practice, libcxx and libcxxabi are developed against specific OSes and specific C libraries.  Support is added for those platforms.  GLIBC, MUSL, UCLIBC, NEWLIB, and a bunch of other C libraries all claim support for C99, but there tends to be little warts in each library that requires libcxx intervention.

On 5/25/2016 9:15 AM, Asiri Rathnayake via cfe-dev wrote:
OK, that makes sense.

So, libc++ essentially assumes C99 + some POSIX extensions like pthreads et. al.

Is it OK to assume that libc++ will not depend on C11 functionality in future?

Thanks!

/ Asiri


On Wed, May 25, 2016 at 3:10 PM, Joerg Sonnenberger via cfe-dev <[hidden email][hidden email]> wrote:
On Wed, May 25, 2016 at 10:46:03AM +0100, Asiri Rathnayake via cfe-dev wrote:
> For example, the current std::thread support (C++11) does not assume the
> underlying C library to be C11 compliant, it instead depends on pthreads.
> On the other hand, we do seem to assume a C11 compliant <ctime> header
> (e.g. timespec).

I think you are confusing C11 functionality with basic POSIX functions.
While C11 might have merged a bunch of things from POSIX, things like
timespec are much older and wildly supported. That's unlike C11
threading for example.

Joerg
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev