|
I think you've hit the nail on the head - the vast baggage that comes along with C++'s attempts to retain (at least superficially) compatibility with the past iterations makes it both incredibly difficult to ensure you are up to date and using the 'correct' constructs, and also means - unless you can avoid using/calling legacy code etc - that there are so many possible ways of doing things that it has become 'too difficult' to use unless you are immersed.
I gave up developing in C++ for the most part when I realised it was taking me more time and effort to understand and use correctly the various constructs that made the language most effective than it was to solve the generally non-time critical problems I was working on. Obviously others will have different experiences and hence viewpoints, I'm not saying mine is the only one.
To my mind C++ has effectively evolved into a new language, so much so that someone coming to it from new is probably in a much better place than someone like me who started with assembly language and has moved through C, C++ etc over the years. I think it is past time really for the latest iteration of C++ to drop all the 'legacy/compatability' stuff and stride out as a new language without all the baggage.
|
|
|
|
|
This assumes that you believe that all of the modern stuff is actually better, which plenty of folks don't. Some of it is clearly useful, but some is very much a matter of opinion. And of course you have to distinguish between the language and the library. A lot of the stuff that most anyone writing new code wouldn't want to use is the old library stuff, while a lot of thew new language stuff is much more debatable as to whether it's better or just different, or whether any advantage is does have is outweighed by different problems it introduces.
Explorans limites defectum
|
|
|
|
|
Let's use an example then. Is it really up to debate/belief, that a static_cast<T> is better, than it's counterpart, the classic cast? The cast where the compiler can check if the cast makes sense and tell me if it doesn't really isn't better than a simple "Shut up and shove the memory", is it? Of course a static_cast isn't always applicable, but then there's dynamic_cast<T> and the rest of the family and while one of the members ain't any better than the cast of olden, it doesn't have to be used in every case where you need a cast. With the old system, there's only one option, the rather dangerous one. Another example, MMA. Manual memory allocation. I simply don't believe you that there's advantages to it when a smart pointer or a library container does the job as well. Well, when talking to a memory-mapped device, static memory is all there is, laying a library container on top will only screw things up because I don't control the memory layout anymore. But that's an edge case, when it comes to business logic, letting the compiler/library do the job is in far most cases superior. Yet the oldtimers insist on doing things the old way no matter whether it's a better idea or not.
The issue I am talking about is that Oldtimers don't bother distinguish between cases, they go with old-and-tried (and difficult to use and dangerous) for the sake of it, not because it's a better idea. And really, unless you write low-level-code (which, let me just put that as a claim, Python programmers usually don't do), the new ways of more abstraction are superior.
|
|
|
|
|
But so much allocate of memory is within a class already. There's nothing really gained by wrapping those things in a smart pointer. It's just more moving parts and syntax and generated code. The memory is already owned and managed by the object that allocated it, and of course deleting those things in the destructor allows you to catch any errors and log them for in the field diagnosis, which you can't do if you are just letting a destructing member delete the memory.
If you are passing allocated objects around, then of course it makes a lot more sense, but that's nothing new. It's been going on for a long time and isn't modern per se.
I certainly agree that stuff like override, member delete, member default, static_cast and such are significant improvements and they don't bring lots of baggage with them that you don't want, unlike a lot of other new stuff. Things like that, which improve type safety and the ability to express semantics are always a good thing in my opinion. I can't believe that we still don't have the option for explicit parameter direction indication.
Explorans limites defectum
|
|
|
|
|
I learned C++ the hard way. God, keep it hard- always. <evil-grin>
|
|
|
|
|
Why bother with that clumsy C++ at all?? People already invented "next C++" named "D". Wonderful language with a lot of features which C++ cannot dream of.
|
|
|
|
|
Let's compare these two equivalent code snippets:
C++:
auto start = std::chrono::high_resolution_clock::now();
doStuff();
auto stop = std::chrono::high_resolution_clock::now();
auto diff = stop - start;
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(diff);
std::cout << "Elapsed ms: " << ms.count() << " ms\n";
Python:
start = time.perf_counter()
do_stuff()
stop = time.perf_counter()
ms = (stop - start) * 1000.0
print('Elapsed ms: ', ms, ' ms')
In this case, the equivalent code is pretty similar, but modern C++ is generally more verbose out of the box.
|
|
|
|
|
And, to be fair, you only got it that small by giving up compile time safety though use of auto, which is one of the reasons you'd use C++ to begin with.
Explorans limites defectum
|
|
|
|
|
Auto deduces the type at compile time, so it's safe unless you intend the variable to be a base class of whatever the initializer returns.
|
|
|
|
|
But that's the problem, you didn't say explicitly what it should be. If the right side gets accidentally changed, nothing is going to complain if what it got changed to supports the same interface (not terribly uncommon in the modern world if lots and lots of operator driven stuff.)
If you explicitly say what it's supposed to be, then two things have to get simultaneous broken in the same way. If you don't, then only one has to get broken for potential silent errors.
Explorans limites defectum
|
|
|
|
|
If that was the case I wouldn't use auto . The situation you described is actually a feature of the auto keyword. It's pretty useful to only change the initializer without have to change the type declaration during refactoring.
|
|
|
|
|
I don't think the point of a language should to make it easy to refactor without having to really think about what you are doing and the potential silent errors it could introduce. Significant refactoring isn't common and it should be approached very carefully. Being explicit it always safer.
Explorans limites defectum
|
|
|
|
|
Dean Roddey wrote: Significant refactoring isn't common
I think you forgot the "joke" icon on your post.
|
|
|
|
|
If you are regularly doing large refactorings, then something is already badly wrong and you have bigger fish to fry, IMO. Maybe better safe than agile?
Explorans limites defectum
|
|
|
|
|
Removing old versions of the .NET Core SDKs. Well over a dozen different versions, including previews for 1.0, 1.1, 2.0, 2.1, 2.2, and 3.0 preview.
There is a list of the current SDK versions at Download .NET Core (Linux, macOS, and Windows).
A painful process as you need to uninstall each one individually.
"Time flies like an arrow. Fruit flies like a banana."
|
|
|
|
|
How many builds broke after that?
cheers
Chris Maunder
|
|
|
|
|
Oh oh, Matt's in trouble,
Chris came along and broke his bubble ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
That bubble already broke. He fixed it though!
cheers
Chris Maunder
|
|
|
|
|
Damnit! Now I've got That Song[^] stuck in my head ... Earwormed myself.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I remember trying to install Mathematica, which uses some library that is distributed with VC++, and there had been so many installs over the years that it just wouldn't work. I had to do a whole OS system wipe to get it to work.
|
|
|
|
|
Do depressed rabbits just not carrot all?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Something doesn't add up - they still multiply.
/ravi
|
|
|
|
|
I think they just hop to it, buck up and get the job done.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
|
Rajesh R Subramanian wrote: that's very bunny. Now that's hare raisingly funny!
/ravi
|
|
|
|