4 ms·
So goto spaghetti is understandable? And dropping those isn't an argument since proper C++ usage also implies agreeing on a proper subset of the language to use
by paulhilbert 8y ago
So goto spaghetti is understandable? And dropping those isn't an argument since proper C++ usage also implies agreeing on a proper subset of the language to use. Modern C++ with sane restrictions is way more easy to understand. Especially w.r.t. resource ownership and lifetimes (as pointed out).
- laumars 8y agoI'm not going to argue that one language is better than another but I do honestly get sick of all this "goto" bashing that often rears it's head. Like all programming constructs, goto can be ugly when it is misused. But there's times when I've simplified code and made it far more readable by stripping out multiple lines of structured code and replacing it with a single goto. So if you're going to argue in favour of C++ with the caveat of good developer practices then you must also make the same caveat of C (ie you cannot play the "goto spaghetti" card) otherwise you're just intentially skewing your comparison to win a pointless internet argument.
- paulhilbert 8y agoNo, I would never argue for C++. The reason being mostly its toolsets (constantly changing, instable and often incoherent). I just don't think readability is an argument - and I am as sick of (pointless) arguments against C++'s readability as you are about goto arguments :) Edit: Just to be clear - there are actual arguments against C's readability. For example when figuring out where and when data gets deleted - but as others have pointed out dynamic memory management is a whole different beast in kernel wonderland.
- coldtea 8y ago>So goto spaghetti is understandable? There's no goto spaghetti in C -- it's only used for local error handling, not for jumping around, at least since the 70s...
- pjmlp 8y agoYou should look at some codebases I occasionally find on enterprise projects.
- coldtea 8y agoEnterprise projects written in C? All 10 of them?
- pjmlp 8y agoI wonder where you are counting those 10 from. Enterprises also write native code, it is not everything Java, .NET and SAP stuff.
- coldtea 8y agoSure, but most of it is in Java, .NET and such. The rest of it could hide any number of dragons (and be written in any kind of legacy, nightmarish, and/or proprietary tools and languages), so it's not much of a proof of widespread bad C "goto" abuse. Let's make a better criterion: how many of the top 200 C projects in GitHub suffer from "spaghetti goto" abuse? How many of all the C projects in GitHub?
- pjmlp 8y agoEnterprise software is much more than just desktop CRUD applications. For example, iOS applications, portable code between Android and iOS, distribution tracking, factory automation, life science devices, big data, graphics are all a small list of examples where C and C++ get used a lot. Sometimes it says C++ on the tin, but when one opens it, it is actually the flavour I call "C with C++ compiler". Github is not representative of enterprise code quality.
- bigato 8y agoYour argument about enterprise code cannot be verified since we can't have access to it. Also, the sample of enterprise code you have access to is probably limited and thus most likely biased. Doesn't seem like a very good general argument, but maybe it is a good one for your own individual situation, if we are to believe your word.