tech-userlevel archive

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

Re: tgmath



On Tue, Sep 26, 2017 at 11:03:09PM +0200, Kamil Rytarowski wrote:
> On 26.09.2017 22:33, Joerg Sonnenberger wrote:
> > On Tue, Sep 26, 2017 at 10:28:23PM +0200, Kamil Rytarowski wrote:
> >> 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.
> > 
> > I see absolutely no reason for wanting to support tgmath.h in pre-C11
> > mode and a lot of very good reasons why it should *not* work.
> > 
> 
> C99 7.22 Type-generic math <tgmath.h>

That doesn't invalidate anything I said. Seriously, C99 doesn't provide
the means to implement it sanely. The sizeof hacks are slow and fragile,
completely inacceptable.

> >> I propose to add for the completeness C++ support in this header as
> >> defined by the C++ standard.
> > 
> > tgmath.h is strictly a C-only header. Again, I see no reason why this
> > trainwreck should be supported by anything but the strict minimum
> > requirements.
> > 
> 
> "For compatibility with the C standard library and the C Unicode TR, the
> C ++ standard library provides the 25 C headers, as shown in Table 154."
> and the table lists "<tgmath.h>". D.5 (Annex D)
> 
> <ctgmath> has been introduced in C++11 and marked deprecated in C++2017
> (draft). Usage of the original C header in C++ code is marked deprecated
> since C++2011 (D.5)
> 
> Keeping C++ compat costs little, there is another option to include for
> C++ >= 2011 the <ctgmath> header, but it depends on the proper C++
> runtime headers. This is why I propose to manually include <cmath> and
> <complex>.

It's been deprecated as soon as it has been added to C++. That's a good
enough reason to not bother either.

Joerg


Home | Main Index | Thread Index | Old Index