Live data from Hacker News

The Ugliest C Feature: tgmath.h

web.archive.org

21–24 of 24 posts

Re: The Ugliest C Feature: tgmath.h

#22

The ternary operator is indeed special as it (is the only one AFAIK that) introduces in the language some type constraints between the two result branches, that affect the way one or the other is interpreted. A similar trick in C++ is explained on https://www.artima.com/cppsource/foreach2.html and allows to return the type of an expression without evaluating it . From the link: > You may be thinking this is needlessl…

For those wondering (like I did)

"But there already is a C++ facility whose sole purpose is determining the type of an expression [or entity] without evaluation it?"

decltype() only exists since C++11 (and the above article is from 2006).

https://en.cppreference.com/w/cpp/language/decltype

Re: The Ugliest C Feature: tgmath.h

#23

With apologies to Philip Greenspun: Any sufficiently complicated C program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of C++.

Yes, but it's most of the good 1/5 of it, with just a little bit of the atrocious 1/3, and the rest taken from the "who cares" 7/15.

Re: The Ugliest C Feature: tgmath.h

#24

With apologies to Philip Greenspun: Any sufficiently complicated C program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of C++.

Sure, but the C++ STL is to code as this [1] is to knives. [1] https://www.amazon.com/Wenger-16999-Swiss-Knife-Giant/dp/B00... .

Now let's see boost in this metaphor :P

(Are there enough knives in the entire swiss army to make this work?)

Post reply on HN