3 ms·
About half of them read as "I tried to use C++ as a worse C" e.g. using struct initilisation instead of constructors, using malloc instead of new or new[]. My
by crest 4mo ago
About half of them read as "I tried to use C++ as a worse C" e.g. using struct initilisation instead of constructors, using malloc instead of new or new[].
My pet peeve with C++ is that the sequence point operator can be overloaded at which point it stops being a sequence point.
- spacechild1 4mo agoWhat's the "sequence point operator"?
- twoodfin 4mo ago,
- spacechild1 4mo agoThat's the comma operator. I didn't know you could overload it! That's pretty crazy. However, I have never seen anyone do that. Do you have any real world examples?
- addaon 4mo agoSee e.g. the very-popular Eigen library, in which the type CommaInitializer basically exists for the sole purpose of overloading `operator,`, allowing a cleaner matrix initialization syntax. https://gitlab.com/libeigen/eigen/blob/master/Eigen/src/Core/CommaInitializer.h https://gitlab.com/libeigen/eigen/blob/master/Eigen/src/Core...
- spacechild1 4mo agoThanks!
- chabska 4mo agoAs the title indicate, this article is comparing construct-to-construct, not idiomatic code to idiomatic code. You probably won't use struct initialization in C++, yet the feature still exist, so it may be useful to someone to compare it to the similar feature in C.