tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: tgmath

On 26.09.2017 21:49, wrote:
> Hi folks,
> warning, if you like C for its simplicity, do not read the below post.
> while looking at the stdatomic nonsense versions, I noticed we are using
> tgmath.h from gcc, but no tgmath.h from clang, if the set lists are to
> believed.
> randomly poking it turned out that in C99 you probably had to be a
> compiler/extensions to implement tgmath*. with C11 generics, you don't.
> attached is a version that could use more testing & careful reading of
> is standard.
> thoughts?
> * sizeof(double) == sizeof(complex float)

Can we just import as-is the FreeBSD version? It has support for pre-C11
compilers. This has header to be supported in the clean C99 mode.

The GNU version supports GCC 2.7, while there is no need to support it
any more (especially since it predates C99 (2.7 has been released in 1995)).

I propose to add for the completeness C++ support in this header as
defined by the C++ standard.

#if (__cplusplus - 0) >= 201103L
#include <cmath>
#include <complex>
// Here is the code from tgmath.h, supported in C++ < 2011 as the NetBSD

This is already handled in GNU libstdc++ and LLVM libc++ internally..
however it would be clearer and future compatible with alternative C++
runtime headers.

Can we please reuse the template license header for new code?
Public-domain might be problematic for strict people (it does not work
for all countries).

Attachment: signature.asc
Description: OpenPGP digital signature

Home | Main Index | Thread Index | Old Index