Slashdot Mirror


Someone on Medium Just Said C++ Was Better Than C (medium.com)

Developer David Timothy Strauss is publishing a call to code "straightforward, easy-to-reason-about approaches" -- in an essay titled "Choosing 'Some C++' Over C". (Alternate title: "C++ for Lovers of C." The problem with just picking C++ is that most criticism of it is legitimate. Whether it's the '90s-era obsession with object orientation and exceptions or the template errors that take up an entire terminal window, there have been -- and remain -- rough edges to C++. But, these rough edges are avoidable, unlike the problems in C that get worse with modern event and library programming. The opinionated essay calls for "adopting a subset of C++ to smooth out C's rough edges," arguing that C++ offer a better, type-safe approach for event-driven design (as well as destructors to avoid memory allocation leaks). Are there any readers who'd like to weigh in on the advantages of C versus C++?

34 of 315 comments (clear)

  1. Indeed by hcs_$reboot · · Score: 5, Funny

    "C++" > "C" (as long as > has not been overloaded..)

    --
    Slashdot, fix the reply notifications... You won't get away with it...
    1. Re:Indeed by allo · · Score: 4, Funny

      In fact, it is not. Try it yourself:

      #include <stdio.h>
      int main(int argc, char **argv) {
          int C=0x11;
          if(C++ > C) {
              printf("C++ is greater than C\n");
          } else {
              printf("C++ is not greater than C\n");
          }
      }

      $ ./a.out
      C++ is not greater than C

    2. Re:Indeed by david.emery · · Score: 3, Informative

      And this highlights the difference between C and C++, and better specified/more tightly defined languages.

      Two C programmers will ask, "What will this program do?"
      Two Ada programmers will ask, "Will this program compile?" Because if it does compile, they both know (and agree on) exactly what the legal program will do.

    3. Re: Indeed by Anonymous Coward · · Score: 5, Funny

      Trick question. There is only one ada programmer.

    4. Re:Indeed by TsuruchiBrian · · Score: 4, Informative

      It also has good features, many of which provide you with an alternative to the bad features of C.

      Constructors/destructors (RAII) > manual initialization/deinitialization.
      Smart Pointers (made possible by RAII) > raw pointers
      Polymorphism > function pointers
      Templates > macros

      If you are subscribing to a streaming movie service and you have the choice between netflix and a site that only allows you to watch "Armageddon (1998)", does it make sense to choose the latter because netflix has more bad movies? No of course not, because you don't have to watch the bad movies on netflix, and you can even choose only to watch movies better than Armageddon.

      C++ is netflix. Nobody watches all the movies. Everyone watches the movies that are good from their point of view (even though many of those people are just wrong).

    5. Re:Indeed by Demena · · Score: 2, Interesting

      You are quite correct. Everyone uses different subsets of C++. The consequence of this should be obvious. Do not use C++ in any circumstances where code has to be maintained. The next maintainer maybe totally unable to deal with it being an expert (and using) a different subset of C++.

    6. Re:Indeed by angel'o'sphere · · Score: 3, Interesting

      WTF, I have to escape less and greater inside of a code tag?

      There are no pointers involved, nor objects.

      The whole thing is for some strange reason "undefined".

      But actually it is pretty clear, why the C community made it "undefined" is beyond me, well: they did not want to impose a rule. But that is mere stupid.


          int s = 1;
          int b = 2; // s means small, b means big

          s < b; // true
          s++ < b++ // true ... usually, because here it starts, it is actually undefined, facepalm

          s++ < s++; // ok, here we have a point, obviously "it should be false" but it is undefined, and somehow makes sense to be undefined -- for me it makes no sense, in Java this is false

          s++ < s; // undefined in C, false in Java. // the original question
          C++ > C; // is only undefined because some guy thought, using the same variable in an expression involving ++/-- more than once is problematic. // actually they should simple have defined the behaviour. E.g. evaluate from left to right and be done with it

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    7. Re:Indeed by johannesg · · Score: 3, Informative

      Just the other way around: it happened because it was checking, and the additional acceleration of Ariane 5 caused an overflow. Without checking everything would have been fine.

    8. Re:Indeed by epine · · Score: 2

      Huh? I think if you read that program and don't know that `C++ > C` == false, you don't know how the post-increment operator works and you're not much of a C programmer.

      This is the reason this entire thread is pointless.

      Going all the way back to the seventies, it was a core design decision in the C language not to over-specify the semantics of expression evaluation to the degree that tricky, efficient implementations became impossible on realistic architectures.

      So the decision was: we're not going to nail your nuts to the floor on side-effects until you reach a sequence point in the expression.

      The C language has a fairly low cognitive burden, and likewise, the world back in the 1970s had a fairly low cognitive burden. One could afford an entire day to actually read K&R.

      Then along comes C++, which follows mostly the same instincts and intuitions, with a desire to maintain a fairly hard standard of compatibility, and now we have a language with a high cognitive burden (in a world with a high cognitive burden) painstakingly built on a foundation that was already trickier than your average ninnie-poo can be bothered to properly master.

      C++ is a fine programming language IF AND ONLY IF you're willing to take on the cognitive burden in the broad spirit of no compromise.

      Before the first Zortech C++, I had already taken this step with the supposedly simple and trivial C language. And I just kept on going in the same spirit when C++ came along. Most of its quirks are there for a reason. It's a big commitment to know all the reasons.

      And here we are in a world where the burden of mastering a tiny handful of C-language quirks lies beyond 90% of the programming population.

      For you people, there's Java. Java even tried to make floating point deterministic across all architectures, present and future, so that ninny-poo legion would never have to learn the first thing about the artful compromise of sequence points and guard digits.

      Java is such a nice cradle to grave language—coffin lid included.

      Personally, I always wanted to be buried in a big boy box, so I put in the effort to know better. The world is so complex now, I would almost classify knowing better as a form of leprosy.

      Emphasis on almost.

    9. Re:Indeed by TsuruchiBrian · · Score: 2

      I don't think you can call yourself a C++ expert and be "totally unable to deal with" a C++ codebase that uses a different subset of C++ than what you would have used.

      You can certainly be a C++ expert and be totally unable to deal with a very poorly designed codebase, but that is true for every language (even C).

      Maybe there are more experts in the C language, because it is a simpler language and therefore an easier language to become an expert at. I would be totally in favor of using a simpler language for a project if there were no benefit to any of the more advanced features provided in C++, but that is rarely the case.

      The 4 things I listed are insanely powerful tools for making safer and more maintainable code, and these things come with little to no performance overhead.

  2. Kids these days... by zm · · Score: 2

    Code in assembly, then you can come back to my lawn..

    --
    Sig ?
    1. Re:Kids these days... by Immerman · · Score: 2

      Moore's law is unlikely to end any time soon - while it's frequently mis-quoted as having something to do with transistor density or speed, the original claim is only that the number of transistors in a dense integrated circuit would double every year (later revised to every two years, and often claimed as 18 months due to being conflated with a prediction out of Intel at about the same time that processing speeds would double that often)

      While transistor silicon speeds are indeed plateauing, transistor counts keep growing as parallel processing technologies improve, and eventually an alternative computation technology will become cost effective, and the cycle will continue. It seems unlikely that RISC-V will still be relevant when Moore's Law finally does end.

      Moreover - if you've hit the limit of your transistor technology, why on earth would you want to switch to a RISC processor? RISC = a smaller set of simpler computations per tick - it's advantage (other than cost) was that you could build a smaller, faster processor so that even if it took several ticks to do what a more complex processor could do in one tick, it could make up for it by having more ticks per second. But if you've hit the limit of your transistor technology, then everybody is running the same number of ticks per second, and overall speed will be determined entirely by how much work you can get done per tick.

      --
      --- Most topics have many sides worth arguing, allow me to take one opposite you.
    2. Re:Kids these days... by slashdot_commentator · · Score: 2

      It is not worth learning assembly.

      You are dead wrong. I wish I had the points to downvote your post.

      You are correct that its not worth learning assembly, in order to learn "modern" software development.

      What makes learning assembly valuable is that it is the most barebone, lowest level set of instructions that a human can cobble together for a CPU to execute. Every other language involves cobbling together hundreds of CPU instructions which would be magnitudes more inefficient than expressing it in assembler. Because higher level languages are designed for humans to understand what they are instructing the CPU to do, in the desire to increase the output of human programmers, at the expense of actual execution efficiency.

      By writing programs in assembler, particularly I/O routines, the human programmer learns how the CPU "thinks". And indirectly, learns to comprehend that all current computers are constructed to the same design specified by Turing back in the beginning. You come to realize that all CPUs work the same way, even though they have different sets of CPU instructions. They're all moving data from storage to memory, memory to register, simple ALU operations in the register, and moving it back to memory and eventually storage.

      Most people cannot read a book, and magically implement code or concepts from scratch. They need to write programs, have those programs fail, and learn to figure out why they failed. That way, those programmers learn how to express what they want done to the machine. Learning assembler is learning how the CPU thinks, and how assembler instructions are building blocks to abstractions. Assembler programmers (and to a lesser extent C programmers) really do understand "what the machine is doing".

      Yes, once you can master assembler for one CPU platform, you'll probably never need to learn to do it for a different CPU, and probably never need to write assembler again. You learn to code assembler to truly grasp how a set of chips operate to produce the simulacrum that is the personal computer.

      --
      There is no America. There is no democracy. There is only IBM and AT&T and DuPont, Dow, General Electric, and Exxon
  3. They both suck! by david.emery · · Score: 2

    At some point, the developer community will wake up to just how evil C -syntax- is, and how much it has contributed to bugs and security holes.

    1. Re:They both suck! by david.emery · · Score: 3, Funny

      On the other hand, monkeys prefer C, because the programs they generate by jumping on the keyboard have the best chance to compile.

    2. Re:They both suck! by phantomfive · · Score: 4, Interesting

      What particularly don't you like about C syntax? I've always thought that the main security problem with C are caused by the lack of a decent buffer processing library, and a lousy string processing library. Fix those two things (and any person can do it in their own code!) and you've fixed the vast majority of C security bugs.

      --
      "First they came for the slanderers and i said nothing."
    3. Re:They both suck! by BarbaraHudson · · Score: 2

      On the other hand, monkeys prefer C, because the programs they generate by jumping on the keyboard have the best chance to compile.

      I think you spelled perl wrong again :-) (hey - it's a feature)

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    4. Re:They both suck! by religionofpeas · · Score: 2

      A good compiler will warn you if you use '=' in a test.

  4. I use awk by jlowery · · Score: 5, Funny

    enough sed. don't bash me.

    --
    If you post it, they will read.
  5. STL != C++ by JustNiz · · Score: 2

    Seems like his gripe is actually with STL and possibly curl's interface, not C++ per se.

    I like C++ (classes, exceptions etc) but generally avoid using STL except possibly for basic things like cout, strings and vectors. STL code becomes unreadable FAST, and quickly turns a simple problem into a giant pain in the ass, especially when debugging.

  6. I know it's April fools, but still ... by BarbaraHudson · · Score: 2
    From the article:

    Set the handle to send a pointer to the struct. The handle expects a void *, so there’s an implicit cast from the struct’s pointer type to, effectively, nothing.

    A void pointer is NOT a pointer to nothing. At least it better not be. :-)

    --
    "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
  7. Undefined behavior by Immerman · · Score: 5, Informative

    Not quite, it is in fact undefined.

    C++ is the post-increment operator, it increments the variable, but then returns the original value. Therefore, since C started out as 0x11, C++ will evaluate to 0x11 while modifying C to be 0x12 as a aside effect.

    Therefore, if you were > optimistic you could try to claim that "C++ < C", expecting the operations to be evaluated left-to-right and thus be evaluated as "0x11 < 0x12". However, C++ doesn't specify the evaluation order of operators, which means that "C" might end up being evaluated before "C++", in which case the comparison would be evaluated as "0x11 < 0x11" instead. The only thing you can be sure of is that C++ will NOT be greater than C.

    Basically, as a rule of thumb you should never modify a variable within a line of code if the value of that variable will matter anywhere else within that same line. http://en.cppreference.com/w/c... - discusses undefined behavior halfway down the page.

    --
    --- Most topics have many sides worth arguing, allow me to take one opposite you.
  8. Re:Actually what the guy wrote was by Dutch+Gun · · Score: 5, Insightful

    People who know and like C will continue to use it. Giant legacy projects written in C (like the Linux kernel) will continue to use C, of course. C++ 11, IMO, is not going to convince C programmers to switch. Rather, it's a love letter to existing C++ programmers due to the radical way it transformed the language.

    It's still ugly as hell, and has sharp corners that will slice your fingers and toes off if you're not careful (we ARE talking C++ here). Even so, for the first time, using just the core language and libraries (Boost doesn't count), I can completely avoid manual memory management in 99% of the cases, almost like using a garbage collector, but with the advantages of destructors for non-memory resources. Raw pointers are almost a thing of the past, except for some very rare exceptions, and move semantics means your APIs can look like you always wanted them to while still remaining efficient. It's hard to describe how different the language feels pre and post 11.

    In my opinion, C++ 11 simply makes C++ far better at creating large, high-performance libraries and applications (in my case, videogames) because of the confidence that robust ref-counted resource management gives you.

    --
    Irony: Agile development has too much intertia to be abandoned now.
  9. Re:Actually what the guy wrote was by goose-incarnated · · Score: 3, Insightful

    C++11 and C++14 added some nifty utility features which make the language worth considering as a replacement for C, even if you have no use for writing your own classes or complex templates (the latter being the usual reason why people would use C++).

    I've been seeing this C++ vs C comparison for quite a while now, especially on Slashdot. The usual argument is "C++ can do everything that C can, and more, hence it is better than C".

    It's a damn stupid argument to make, and the makers should rightfully feel stupid for making it. Say "C++ can do everything C can, and more" is just a different way of saying "C++ has all the gotchas of C, AND MORE".

    We write the code to be read by humans, hence anything that adds to the errors made while reading is a *bad* thing, not a good thing. It's fine you add new cognitive traps as long as you are removing existing ones!

    When I need a language that is higher level than C, I do not reach for C++ - the alternatives are better. When I don't need anything better than C I use C.

    Frankly, I cannot think of a situation in which the lack of features in C cause me to reach for C++. When I want those features I'd reach for Java instead and code the performance critical stuff in C anyway.

    The repeated comparisons showing C++ to be a better C is stupid because C++ has all the traps that C has, and adds a whole lot more. When I need the features offered by C++ I can use Java[1] and avoid the pitfalls of C *and* C++.

    [1] Depending on circumstances, I'd use Java for large-team dev, Lisp when I'm solving problems solo (hobbying), Tcl+Tk or Python+Tk when I'm doing a once-off make-my-life-simpler GUI script. Mostly I use bash. For daily dev as an embedded guy in safety-critical environments I use C.

    I probably won't change to C++ for this case, as having the ability to look at a code snippet in isolation and know exactly what assembly will be generated is an advantage.

    --
    I'm a minority race. Save your vitriol for white people.
  10. I started off with C by Brian+Feldman · · Score: 2

    It's my most familiar language, back from when I was learning it on the schoolbus by reading K&R. I would still never choose C over a carefully-selected subset of C++ for a new project. There is just no advantage to keeping things more primitive except when it comes to very specific environments, like traditional Unix kernels. I think templates are very useful in limited doses and far superior than macros, inheritance is somewhat useful to almost any kind of CS problem, and the STL itself is a huge boon to software reliability and interoperability.

    Of course, I also have no qualms with Java, so....

    --
    Brian Fundakowski Feldman
  11. I worked on a C++ device driver by AaronW · · Score: 5, Interesting

    In the 1990s I worked on a complex device driver for OS/2 for ATM networking (asynchronous transfer mode). The driver was around 100K lines of C++ code however only a subset of C++ was used. Surprisingly the use of C++ worked out quite well. We had an equivalent driver for Windows NT that was written in C that was over 300K lines of code. The C++ codebase was a lot more reliable and easier to work on, despite all the work that was done to make C++ work in kernel mode under OS/2. The C++ driver actually had more functionality than the C driver and it was faster as well with a smaller binary. Also, as I said, it was a subset of C++, especially in the performance critical code. The driver in question included the entire ATM signalling stack and implemented full LAN emulation support with both Ethernet and Tokenring plus it could emulate multiple networks (ELANs, equivalent to VLANs) simultaneously. When I implemented multiple ELAN support I was afraid it was going to be a nightmare, but due to the way it was architected in C++ I ended up only having to change a few lines of code, changing a pointer to the LANE class to an array of pointers.

    For the signalling stack and ILMI C++ worked out especially well due to the event and message based nature of it and the various state machines. For LAN emulation it made it easy to support both Ethernet and Tokenring by having a few virtual functions in the main LANE class.

    There was no exception handling support and none of the more complex C++ features were not used. It used templates but that was also somewhat limited.

    Having destructors was also quite nice, making it easy to clean up resources.

    Despite being C++, debugging wasn't too bad though at the time the OS/2 kernel debugger basically ran at the assembly level.

    If the infrastructure is in place I can certainly see using C++ in the kernel and device drivers.

    --
    This post is encrypted twice with ROT-13. Documenting or attempting to crack this encryption is illegal.
    1. Re:I worked on a C++ device driver by slashdot_commentator · · Score: 2

      That's the main problem with C++. It is incredibly hard to know what is happening behind the scenes (will this object allocate memory or not?), so one has to be very careful in performance-critical parts.

      Its more difficult to know what's happening below the source code level, because C++ is conceptually more abstract than C. But ANSI C is an abstraction as well. Its not like the days of K&R C, where you knew what the parameter passing code looked like in assembler. And C++ being a higher level of code abstraction than C is a good thing. If you know how to code C++, you avoid all the problems with loose pointers, and memory leaks, and human implementation errors prevalent with C.

      (will this object allocate memory or not?)

      That is a horrible example. You always should know when an object allocates memory, because C++ doesn't intrinsically do automatic memory allocation and garbage collection. You have to write that in with constructors and destructors. Yes, the programmer may not do that properly, but it shouldn't be a problem to debug when it occurs.

      And then using a C++ subset you know performs well, or just programming in C is the way to go.

      If you're a mediocre programmer, you will be more likely to produce a working program in C, but it will be also more likely to contain bugs. That does not mean C is a "better" language for real-time system code than C++.

      If you just want a program that runs well and you don't care about the last 30% of performance, you don't need to know as many details of C++,

      Again, that is part of the B.S. about C++ being less efficient than C. I already brought up the example of the L4 microkernel. Many windowing and graphics libraries are written in C++, and they don't suffer from a 30% inefficiency compared to a library written in C. If you don't have a mastery of C++, then you're not going to write efficient code in C++; that is true for any language on that level.

      --
      There is no America. There is no democracy. There is only IBM and AT&T and DuPont, Dow, General Electric, and Exxon
  12. Re:I like a lot of the C++ features by AaronW · · Score: 2

    I found the same thing when I was handed a large project in C++. In this case it was a very complex kernel-level OS/2 device driver. It took me a while to adjust to C++ but once I did I certainly saw the advantages.

    With C we're always reinventing the wheel and doing things the hard way. I say this as someone who works on bootloaders and has worked on a lot of device drivers and works close to the hardware. C++ requires more support than C to get basic functionality working, but once it's there a lot of code becomes simpler.

    --
    This post is encrypted twice with ROT-13. Documenting or attempting to crack this encryption is illegal.
  13. C vs C++ by woboyle · · Score: 2

    I have been writing C since the early 80's and C++ since the early 90's. For large-scale robust systems, C++ is the way to go. It provides for greater degrees of abstraction, debug-ability, and clarity of intent. I only use C any longer for kernel development.

    --
    Sometimes, real fast is almost as good as real-time.
  14. Re:Actually what the guy wrote was by swillden · · Score: 4, Informative

    In exchange for manual memory allocation, C++ gives you automatic memory allocation: lots of it.

    Nonsense. You don't get memory allocation unless you ask for it.

    When resources are scarce (eg. IOT devices) this overhead can be a show stopper.

    You're misinformed. With C++11 move semantics, you can have both safe, automatic ownership management, and no unnecessary dynamic allocation. Most of my work is done in a very constrained environment, where I have only a handful of pages of heap... or in some cases none at all. C++ is awesome for such environments.

    Something that C++ advocates seem to ignore there is no free lunch.

    No one is claiming that there is. What there is, is the opportunity to delegate tedious and error-prone due diligence that C programmers have to do themselves to the compiler. For example, you know all those functions that have comments describing whether the returned data structure's contents are owned by the caller or the library? In C++ you can write the function so that it's impossible for the caller to avoid taking ownership when that's what you want, or so that it's impossible for the caller to believe it has ownership when the library is retaining it. If the caller gets it wrong, the compiler will flag the error. That's one example, there are many, many more. C++ enables you to have buffers and strings that do automatic bounds checking... or even to write code such that potential bounds violations are flagged by the compiler, making run-times bounds checks provably unnecessary.

    There's no magic here, just language constructs that allow you to accurately specify the semantics you want, which the compiler can enforce.

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  15. Well, duh - it is by johannesg · · Score: 3, Informative

    C++ is much better than C. It's much greater expressiveness makes it easy to clearly formulate what you are doing, and in far fewer lines of code too. Exceptions free you from all that tedious boilerplate, where every function call basically expands into three lines: error=function();if (error) handle_error (error);. RAII makes resource handling painless. It's massively more powerful standard library provide instant access to lots of useful datastructures and algorithms, and unlike C it's all typesafe too.

    Is it hard to use? Hardly. I find C hard to use - just imagine having to write an application that uses strings, it'll be one giant mass of mallocs, strcats, strcpys, frees (don't forget any!), and will invariably end in buffer overflows and lost memory. Oh, and it will probably have a whole bunch of gotos for what they laughingly call 'resource management', Dijkstra's 1968 paper notwithstanding.

    Do I disagree with all the criticism, then? No - but the horror stories that get posted here do tend to be worst possible cases, which pop up once in a very long while, rather than the daily occurrences some people make them out to be. It's been... I don't know, half a decade or so? since I last saw one of those horrifying template errors - and it's not for lack of templates in my code. It's not really a hard language either - sure, you _can_ write unreadable statements, but you can do that in any language so that doesn't mean much. It also gives you the tools to write much, much clearer code.

    I always roll my eyes when people mention needing a 'cut-down C++'. That's lack of understanding, usually mixed with a liberal dose of unwarranted fear, and better advise would be "use common sense". For example, there is nothing wrong with overloading operators, but common sense indicates one should not change the meaning of those operators. Having your own number-like class is fine (for example, for complex numbers, bignums, money, whatever), and overloading operators for it is an excellent idea. Using operator+ to paint a widget or retrieve data from a database - maybe not so much.

    So, yeah, C++ is an amazing language. Hmm, that makes me wonder if there will be an article on Medium now, revealing that someone on Slashdot just said that. I don't know that website, maybe they are not into clickbait so much...

  16. Re: Actually what the guy wrote was by Tough+Love · · Score: 2

    C++ meets or beats C in all but a very few respects. Designated initializers is a really painful and stupidly short sighted omission. C++ has a wealth, even a surplus (see "most vexing parse") of initialization mechanisms, but none of them can do what design initializers do. Unfortunately, when converting C code to C++, this frequently results in maintainability regresses as code has to be converted to rely more on positional parameters... which you hope you have correct, but you don't always, and you hope the order of members never change, but it does.

    --
    When all you have is a hammer, every problem starts to look like a thumb.
  17. Generally I only use a subset of C++ by w3woody · · Score: 3, Insightful

    I first started using C++ back in the 1980's.

    I am a huge fan of classes. When C++ was basically a preprocessor for C which introduced the class keyword, I thought it was pretty cool.

    When exceptions were introduced to the language I thought C++ was fairly complete as a language. If from there the designers of C++ had addressed the fragile base class problem, lambdas and some form of introspection, I think C++ would have been a fantastic language.

    Instead, we got templates. I'm not a fan of templates.

    And when we got the standard template library, I thought someone was smoking crack. Using the left shift and right shift operators to mean "input" and "output"? Really? Really?!?

    When I write C++ I try to stick to using a subset of C++ which includes classes and exceptions. I use templates sparingly, only when they are really needed, and I refuse to use the C++ left-shift and right-shift operators. (I really feel like the person who designed that thought "how cool; we can override a shift operator to mean input and output!" But just because you can doesn't mean you should, and now we're stuck with this bit of syntactic bit of bullshit.

    We're finally getting around to lambdas, though too late: Apple has already wedged blocks into a non-standard extension. And I'm not holding my breath on introspection or on fixing the fragile base class problem simply because the run-time implementation recommendation for classes way back in the late 1980's has become a baked in de-facto feature. (Sadly it would have been relatively easy to solve by introducing link-time assignment of the indexes in the virtual table pointer; that way, as the base class is recompiled the index references for the methods in the virtual table could be reassigned at link time. This also solves fragile access to public class fields; simply replace them with a standard getter and setter method which is accessed via the virtual table.)

  18. Silly language debates by Qbertino · · Score: 3, Informative

    C++ done right is do vastly different from C that debating which language is better is beyond silly. This goes threefold if you look at C++14 programmed with the GSL - the right way to do C++ these days.

    In a nutshell C is assembler 2.0 and C++ is assembler 3.0. C++ has massive inner api advantages over C that C tries to compensate for with libs such as boost.

      Yet build with C++ without knowing what you are doing and of course you'll produce bad software. With C you simply won't get anywhere.

    Wether you use one or the other these days is often a matter of personal preference more than anything else. C++ has massive ready-made power with the responsibilty that comes with it. Any programmer looking at these PLs will see the difference and adapt his style of coding accordingly.

    --
    We suffer more in our imagination than in reality. - Seneca