logoalt Hacker News

PaulDavisThe1sttoday at 3:37 PM3 repliesview on HN

You can take

   for (auto const & ess : esses) {
         ...
   }
from my cold dead hands.

Also, you can fight me if you want to take

      dynamic_cast<Derived> (base_ptr)
and force me to implement my own typing system every time I need to upcast.

Basically, stick with C and leave C++ programmers alone. I haven't seen a less useful article about C++ in a long time, and as an HN reader, that's really saying something.


Replies

rfgplktoday at 4:04 PM

One thing I've noticed about a lot of these "strict C" developers is that quite often they actually refuse to learn C++. One of the most common complaints of C developers regarding C++ is "it does things behind the scenes/performs magic", often with regards to operator overloading. When they refuse to actually look at the implementation (y'know you can check if an operator has been overloaded) AND they refuse to acknowledge that a huge chunk of "pure C" does HEAPS of magic behind the scenes (that the developer has no idea about) unless they've actually studied the spec in detail. Malloc and memory allocation methods are at least 10k+ lines of code for instance.

show 6 replies
cyber_kinetisttoday at 4:41 PM

LLVM uses a hand-rolled version of RTTI for the best performance (the parent constructor accepts its runtime type as an enum), and it seemed that the maintenance costs for it aren't that high. (See https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html)

Or if you're even lazier, you can easily make a more automatic RTTI system with some templates / macros that works much faster than dynamic_cast! (See https://github.com/royvandam/rtti)

my-next-accounttoday at 4:53 PM

Implementing STL iterators are a bloody PITA

show 1 reply