Re:Why should I have written ZeroMQ in C, not C++ (2012)
by nulltype on Thursday May 21, 2015 @04:00AM
(#9581494)
I've seen some pretty impossible to comprehend or debug uses of templates. Perhaps my favorite, which represents most of the pitfalls you can create with C++ is the Boost library. And of that, the shining star is this page: http://www.boost.org/doc/libs/1_57_0/libs/geometry/doc/html/...
[ Parent
| on HN ]
Re:Why should I have written ZeroMQ in C, not C++ (2012)
by vitaut on Thursday May 21, 2015 @09:38AM
(#9582641)
I wouldn't call it a pitfall. Boost is written by C++ experts who like to push the boundaries of what can be done with the language. This doesn't mean that you have to debug their code or overuse templates yourself and there is nothing in the language that encourage this. For common cases such as in the standard library, templates are pretty easy to use and trivial to debug with modern compilers.
Re:Why should I have written ZeroMQ in C, not C++ (2012)
by GFK_of_xmaspast on Thursday May 21, 2015 @10:26AM
(#9582911)
Given the design constraints:
""" A generic library should be able to calculate the distance: for any point class or struct, not on just this mypoint type in more than two dimensions for other coordinate systems, e.g. over the earth or on a sphere between a point and a line or between other geometry combinations in higher precision than double avoiding the square root: often we don't want to do that because it is a relatively expensive function, and for comparing distances it is not necessary """
I suspect a little bit of complexity is necessary. (And can you even build something like this in a more fashionable language?)