Earlier quoted context omitted.
Good luck finding a language out there that doesn't have pitfalls.
To be fair I think most languages don't have pitfalls as defaults in the C++ sense :D
Why should I have written ZeroMQ in C, not C++ (2012)
41–50 of 147 posts
Re: Why should I have written ZeroMQ in C, not C++ (2012)
#42These and many other pitfalls are all discussed in detail in the C++ FQA Lite: http://yosefk.com/c++fqa/exceptions.html#fqa-17.1 http://yosefk.com/c++fqa/ctors.html#fqa-10.17 http://yosefk.com/c++fqa/exceptions.html#fqa-17.3 The FQA helped my crystallize a lot of the reasons I hated C++. Even if you like C++, it's a good idea to understand the FQA's arguments, for the same reason people play devil's advocate.
Re: Why should I have written ZeroMQ in C, not C++ (2012)
#43Re: Why should I have written ZeroMQ in C, not C++ (2012)
#44Earlier quoted context omitted.
Multiple return values is now handled in C++ with tuples and std::tie.
While it works, it would be better if multiple return types were supported natively by the C++ language precisely because of this: #ifdef _WIN32 # ifdef EXPORTING # define DECL __declspec(dllexport) # define STORAGE # else # define DECL __declspec(dllimport) # define STORAGE extern # endif #else # define DECL # define STORAGE #endif // For every return tuple type actually used: STORAGE template class DECL std::tuple…
This alone makes exporting STL objects pretty much impossible in a sizable cross-platform project, in my experience.
Re: Why should I have written ZeroMQ in C, not C++ (2012)
#45Earlier quoted context omitted.
Yes, it shares that 'feature' in common with JavaScript.
No, actually, it doesn't. C++ is a huge language, javascript is a relativly small one. I know it's funny to compare the size of "Javascript the good parts" with "Javascript the definitive guide", but that's can be attributed to writing style more than percentage of language covered.
Perhaps less in what features to avoid, but there's plenty of hidden gotchas to avoid in JavaScript still.
https://www.youtube.com/watch?v=et8xNAc2ic8 https://dorey.github.io/JavaScript-Equality-Table/
> C++ is a huge language, javascript is a relativly small one.
C++'s ISO/IEC 14882:2003 weighs in at 786 pages, compared to ECMA-262 (5.1 Edition)'s 258 pages (measuring by PDF reader). A ~3x difference, but not quite the order of magnitude I'd expect from huge vs small.
Re: Why should I have written ZeroMQ in C, not C++ (2012)
#46These and many other pitfalls are all discussed in detail in the C++ FQA Lite: http://yosefk.com/c++fqa/exceptions.html#fqa-17.1 http://yosefk.com/c++fqa/ctors.html#fqa-10.17 http://yosefk.com/c++fqa/exceptions.html#fqa-17.3 The FQA helped my crystallize a lot of the reasons I hated C++. Even if you like C++, it's a good idea to understand the FQA's arguments, for the same reason people play devil's advocate.
And even so, a lot of very senior C++ users will disagree with the FQA's recommendations.
Re: Why should I have written ZeroMQ in C, not C++ (2012)
#47Interesting article. So, more confirmation C++ is inferior for writing predictable or high performance applications. I actually see an opportunity for a C-compatible or C-competitive systems language here to beat C++ at its own game. Zero-cost abstractions plus solving C++'s specific problems, painless C FFI, and compilation to C (or LLVM) to leverage their compilers. Might make a nice combo. I doubt we'll see much t…
Rust [1], basically!
Re: Why should I have written ZeroMQ in C, not C++ (2012)
#48This actually sounds like an argument for why he should've used a smaller subset (or different) of C++. For example: make all constructors private and empty and use public static factory methods for manufacturing new instances. Now the factory can fail, and return an error to boot. Similarly, ditch C++ exceptions and introduce the notion of a status object that methods return. You always have the option of C-style se…
And so I will continue to avoid C++ because I'm not a master and will not avoid the many pitfals, and I want to get things done, not become a master of C++.
Just switching compilers makes the C code more robust.
Re: Why should I have written ZeroMQ in C, not C++ (2012)
#49Earlier quoted context omitted.
No, actually, it doesn't. C++ is a huge language, javascript is a relativly small one. I know it's funny to compare the size of "Javascript the good parts" with "Javascript the definitive guide", but that's can be attributed to writing style more than percentage of language covered.
> No, actually, it doesn't. Perhaps less in what features to avoid, but there's plenty of hidden gotchas to avoid in JavaScript still. https://www.youtube.com/watch?v=et8xNAc2ic8 https://dorey.github.io/JavaScript-Equality-Table/ > C++ is a huge language, javascript is a relativly small one. C++'s ISO/IEC 14882:2003 weighs in at 786 pages, compared to ECMA-262 (5.1 Edition)'s 258 pages (measuring by PDF reader). A ~3…
That's not meant to be snarky, but what's is the minimum size of a language spec? I don't know the answer, but I'd think the delta over that would be the better comparison. For example if you can't really spec a language in less than 200 pages then C++'s spec is more like 10 times as big as JavaScript.
Re: Why should I have written ZeroMQ in C, not C++ (2012)
#50Interesting article. So, more confirmation C++ is inferior for writing predictable or high performance applications. I actually see an opportunity for a C-compatible or C-competitive systems language here to beat C++ at its own game. Zero-cost abstractions plus solving C++'s specific problems, painless C FFI, and compilation to C (or LLVM) to leverage their compilers. Might make a nice combo. I doubt we'll see much t…
It exists already, only needs more libraries and more users.
Yes, they are removing the GC dependency from the standard library.