Re: Will therefore GDB utilize C++? Not.
Posted Apr 14, 2012 16:45 UTC (Sat) by jzbiciak
(✭ supporter ✭
In reply to: Re: Will therefore GDB utilize C++? Not.
Parent article: Re: Will therefore GDB utilize C++? Not.
To me, Boost demonstrates what can be achieved with a powerful metaprogramming language, and makes a strong argument for designing a strong, capable metaprogramming language into any new language.
It also demonstrates what talented hackers can achieve with mechanisms that were never intended to be used this way.1 They abuse the C++ type system and name resolution in ways that turn it into a poor-mans functional programming environment. It's a cute and useful hack when it works, but anyone who's looked at three pages of error-spaghetti when they make a 1-character typo understands that it's incredibly fragile.
I personally use both C and C++. My normal use model for C++ is to not get too fancy beyond what C can do, and mainly just rest on its stronger type checking to catch my errors. I also love namespaces for segregating symbols from each other. I also do the occasional templates to reduce case-and-paste when I need to implement the same function for multiple types, and the function is bigger than what you might put in a macro. Otherwise, for random programs, I fall back to C or Perl depending on the need.
In fact, the features I use the most in C++ (namespaces, stronger type checking, template functions, overloaded functions) could find a home in C without really breaking C, if they brought them in carefully enough. Although, I can see reasonable people disagreeing, strongly even.
1 The C++ type and name resolution system was discovered to be a functional programming environment almost entirely by accident. Famously, its computational capabilities were first demonstrated at a standards committee meeting, where Erwin Unruh demonstrated a program that produced prime numbers in error messages at compile time.
to post comments)