4 ms·
I've seen this complaint a lot, but I don't get it. For C++, the system package manager (yum, apt, pacman) seems sufficient to install most anything I've ever
by xscott 5y ago
I've seen this complaint a lot, but I don't get it. For C++, the system package manager (yum, apt, pacman) seems sufficient to install most anything I've ever needed. Are you programming under Windows?
My biggest complaints about C++ generally revolve around all the inconsistencies / special cases, and I believe these are mostly in the name of backwards compatibility. For any of the major compilers:
- Integer literals are 32 bits, even on 64 bit platforms. You almost always want a ssize_t, but you get an int, and int is almost always 32 bits. (let's dodge the religious war about unsigned vs signed)
- String literals are basically const char star pointers, but you should hold them in a string class.
- Even the syntax for declaring a variable is a total mess. Depending on details about foo (initializer_list, POD type, explicit constructors, etc), there are a lot of special cases in the following:
foo x;
foo x(); foo x(1); foo x(1, 2);
foo x{}; foo x{1}; foo x{1, 2};
foo x = {}; foo x = { 1 }; foo x = { 1, 2 };
foo x = foo(); foo x = foo(1); foo x = foo(1, 2);
auto x = foo(); auto x = foo(1); ...
For some of those, you can't even know what's really happening unless you know the specific implementation of the type/class. And as a special bit of trivia, one of those doesn't even declare a variable.
- There are a lot of special cases and non-obvious idioms around declaring constructors and assignment operators.
I think it's too much to remember all the rules, so most everyone is forced to find a subset of the language out of necessity.
- duped 5y ago> For C++, the system package manager (yum, apt, pacman) seems sufficient to install most anything I've ever needed The system package manager installs globally and prefers dynamic linking. This makes it generally impossible to distribute software reliably without packaging it for the system package manager being used. Dependencies should be local to the project and prefer static linking to avoid deployment/distribution errors.