3 ms·
In C++ it's even easier than in C to safely use stack-based allocation (thanks to RAII) so this it's better because it's C rather than C++ is a huge warning sig
by shin_lao 13y ago
In C++ it's even easier than in C to safely use stack-based allocation (thanks to RAII) so this it's better because it's C rather than C++ is a huge warning sign.
- masklinn 13y agoIt's not like the author just made this assertion out of the blue, he previously made 2 posts about the issues he had having used C++ for ZMQ: http://250bpm.com/blog:4 http://250bpm.com/blog:4 http://250bpm.com/blog:8 http://250bpm.com/blog:8
- shin_lao 13y agoThe purpose of C++ is to provide experts with a toolbox to do anything without any compromise. This is why the language is hard to master and very easy to misuse. It's a two edged sword literraly. Although in C++ one could say it's more like a two-edged chainsaw. In this case, I would simply say that the author problem is more about how he relates to C++ than about C++ itself. Saying C++ is abrasive is a valid point, but saying it cannot be as fast as C or it cannot do "something" is stratospherically stupid.
- vidarh 13y agoWho is saying it cannot be as fast as C? The original post only claims that it makes his life easier, and then makes two further claims about the C implementation without stating you can't achieve the same in C++. He then links to a post where he goes into more detail, including _explicitly pointing out_ you can do the same in C++, but that he believes that the language encourages you to think in certain ways that negatively affects these factors. It seems to me that he is stating his reasons for why he believes C is the best choice, and particularly for him, without making any claim that it is objectively better. In other words, unless I've completely missed something, you are setting up strawmen.
- shin_lao 13y agoI was referring to his original rant on C++: http://250bpm.com/blog:4 http://250bpm.com/blog:4 and http://250bpm.com/blog:8 http://250bpm.com/blog:8. They are pretty misinformed. He claims in C++ the erasing solution is O(n) where it is O(1) in C. This doesn't make any sense of course. The comments you are referring to where he moderates his position are resulting from the comments he received from the C++ community regarding his incorrect statements.
- malkia 13y agoBut then if you have some 3rd party library code using setjmp/longjmp (libjpeg and others) this would no long work with RAII - no unwinding would be done. That is if the your library calls a "callback" which calls one of the said 3rd party libs (or your code) with longjmp