Earlier quoted context omitted.
> How many other languages have a Turing complete sublanguage built into them just to handle templating? On the bright side, C++ doesn't have obscure keywords like "cdr" and "car" that refer to specific hardware elements of an obsolete computer built in 1954.
Nope, only trap representations, in case you are using an Itanium for some reason.
You can't make C++ not ugly, but you can't not try (2010)
81–90 of 187 posts
Re: You can't make C++ not ugly, but you can't not try (2010)
#82Earlier quoted context omitted.
I still think the STL containers are the sane default to reach for & switch to more obscure ones when the problem domain and performance requirements say to use a different one.
You have that backwards. The STL containers are for when you have a hyper-specific niche use case. They are otherwise terrible defaults and everyone should use boost or abseil by default otherwise. std::map, for example, is only appropriate if you need a red-black tree specifically. Which almost nobody does. std::unordered_map is less awful, but abseil has a literal straight upgrade. With the same API. So... why woul…
That assertion makes no sense at all. The stl contrainers work very well as basic generic containers that can safely be used for pretty much any conceivable use where performance isn't super critical. I'm talking about cases like, say, you need to map keys to values but you don't really care about performance or which specific data structure you're using. That's stl's domain: robust, bullet-proof implementations of basic data structures that are good enough for most (or practically all) cases with the exception of a few very niche applications.
If you happen to be one of the rare cases where you feel you need to know if a container is built around a red-black tree or any other fancy arcane data structure, and if this so critical to you that you feel the need to benchmark the performance to assess whether you either need to use non-defaults or completely replace parts or the whole container with a third-party alternative... Then and only then the stl is not for you.
Re: You can't make C++ not ugly, but you can't not try (2010)
#83Earlier quoted context omitted.
To the contrary, modern C++ has solved very few, if any, of the problems described in the article. Being generous: * There's now `std::string_view` to address some of the problems with `std::string`, but the rest are still there. There are some attempts to specify the encoding now, at least. * Lambdas and `std::function` pretty much solve the function pointer complaints, with some added complexity. * Containers still…
2 people equally confident in their own, completely opposing opinions. Every comment enabled website in a nutshell.
Also known as a debate.
Re: You can't make C++ not ugly, but you can't not try (2010)
#84This decade old article describes an ancient and obsolete language (C++03 probably though some of the text suggests it might be C++98). It's not worth reading in 2020. Modern C++ is a very different language though it can still almost completely interoperate with quite old code. C++11 and C++14 already addressed most of the things brought up, and contemporary C++ (obviously most code is not in it yet) even supports g…
You wish. Unless I'm terribly misinformed, "modern C++" contains all of the features of the prior versions, which means that in the real world you have to learn and deal with all of it .
That makes as much sence as claiming that to develop software in, say, Python on the real world you have to learn and deal with all of its standard library.
That is not the case. That has never been the case ever for any programming language, be it large or small. Specially in C++, where since it's inception the standard approach is to, at best, adopt a subset of all features and stick with it.
Re: You can't make C++ not ugly, but you can't not try (2010)
#85Earlier quoted context omitted.
You have that backwards. The STL containers are for when you have a hyper-specific niche use case. They are otherwise terrible defaults and everyone should use boost or abseil by default otherwise. std::map, for example, is only appropriate if you need a red-black tree specifically. Which almost nobody does. std::unordered_map is less awful, but abseil has a literal straight upgrade. With the same API. So... why woul…
Because that way you don't need to haul in dependencies unless you have a real reason. std::function is fine for prototyping, but its size hit is extreme , so in embedded code we use other implementations. But where size and speed doesn't matter? Why bother?
Re: You can't make C++ not ugly, but you can't not try (2010)
#86Earlier quoted context omitted.
Some of us still have to use outdated C++ compilers where the ::std namespace doesn't exist and all the modern goodies are but a dream.
Yikes, what platform is this?
Re: You can't make C++ not ugly, but you can't not try (2010)
#87Earlier quoted context omitted.
Because that way you don't need to haul in dependencies unless you have a real reason. std::function is fine for prototyping, but its size hit is extreme , so in embedded code we use other implementations. But where size and speed doesn't matter? Why bother?
I'll use java where size and speed doesn't matter.
Re: You can't make C++ not ugly, but you can't not try (2010)
#88Earlier quoted context omitted.
You have that backwards. The STL containers are for when you have a hyper-specific niche use case. They are otherwise terrible defaults and everyone should use boost or abseil by default otherwise. std::map, for example, is only appropriate if you need a red-black tree specifically. Which almost nobody does. std::unordered_map is less awful, but abseil has a literal straight upgrade. With the same API. So... why woul…
> You have that backwards. The STL containers are for when you have a hyper-specific niche use case. That assertion makes no sense at all. The stl contrainers work very well as basic generic containers that can safely be used for pretty much any conceivable use where performance isn't super critical. I'm talking about cases like, say, you need to map keys to values but you don't really care about performance or which…
You're arguing it's better to use something that's across the board worse for nearly every user, and by a lot, just because... why? It's slightly more convenient?
Re: You can't make C++ not ugly, but you can't not try (2010)
#89Earlier quoted context omitted.
> You have that backwards. The STL containers are for when you have a hyper-specific niche use case. That assertion makes no sense at all. The stl contrainers work very well as basic generic containers that can safely be used for pretty much any conceivable use where performance isn't super critical. I'm talking about cases like, say, you need to map keys to values but you don't really care about performance or which…
This makes no sense. The STL is the specialized containers with obscure performance characteristics & behaviors. Boost & abseil provide the generic, reasonable default ones. You're arguing it's better to use something that's across the board worse for nearly every user, and by a lot, just because... why? It's slightly more convenient?
Re: You can't make C++ not ugly, but you can't not try (2010)
#90Earlier quoted context omitted.
You have that backwards. The STL containers are for when you have a hyper-specific niche use case. They are otherwise terrible defaults and everyone should use boost or abseil by default otherwise. std::map, for example, is only appropriate if you need a red-black tree specifically. Which almost nobody does. std::unordered_map is less awful, but abseil has a literal straight upgrade. With the same API. So... why woul…
Because that way you don't need to haul in dependencies unless you have a real reason. std::function is fine for prototyping, but its size hit is extreme , so in embedded code we use other implementations. But where size and speed doesn't matter? Why bother?
These are all largely header libraries. You're already hauling in a dependency, and in every c++ file that uses it at that.
> std::function is fine for prototyping
std::function isn't part of the containers library of the STL (containers being all the stuff here: https://en.cppreference.com/w/cpp/container ). I agree std::function is fine, it even has a pretty reasonable small-size optimization.