Slashdot Mirror


Bjarne Stroustrup Reflects On 25 Years of C++

eldavojohn writes "Today roughly marks C++'s first release 25 years ago when about six years of Bjarne Stroustrop's life came to fruition in the now pervasive replacement language for C. It achieved ISO standardization in 1998 and its creator regularly receives accolades. Wired's short interview contains some nice anecdotes including 'If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it' and 'I'll just note that I consider the idea of one language, one programming tool, as the one and only best tool for everyone and for every problem infantile. If someone claims to have the perfect language he is either a fool or a salesman or both.' There's some surprising revelations in here, too, as his portable computer runs Windows."

87 of 553 comments (clear)

  1. Olde Saying by Anonymous Coward · · Score: 5, Funny



    C++ is to C as Lung Cancer is to Lung.

    Truer words have never been spoken.

    1. Re:Olde Saying by pelotom · · Score: 2, Funny

      I like this one (can't remember who said it): "C++ is an octopus made by nailing extra legs to a dog."

    2. Re:Olde Saying by fbjon · · Score: 2, Funny

      More like a big nuke missile, but with the warhead removed. It's still big, bulky, and not very nimble, but it goes exactly where you want it to go, and it doesn't blow everything up.

      --
      True confidence comes not from realising you are as good as your peers, but that your peers are as bad as you are.
    3. Re:Olde Saying by euyis · · Score: 3, Insightful

      I read this as: like cancer, C++'s stronger and much more powerful than its old host; taking all the nutrition and grows bigger and bigger at mindblowing speed; changes (mutates) quickly and spreads to everywhere expanding its influence. Unfortunately all these things come at the expense of C and other languages.

    4. Re:Olde Saying by e70838 · · Score: 2, Informative

      In fact, Linus has tried to move the kernel to C++ in 1992. At that time, g++ was a piece of crap.
      The lessons learned from this experience (outside the fact that g++ was unstable) is that C++ has some strong limitations when used in a kernel and that he would never use again C++.
      Good C++ compilers have appeared only recently (before 2000, Comeau C++ was the single almost standard compliant compiler). Comprehension on what is good coding style in C++ is more recent. We keep many garbage from the previous era: bad libraries, bad coding style guides, ...
      For people that have discovered C++ recently, Linus opinion may look exaggerated, but do not accuse him of not understanding C++. You will look very misinformed.

  2. Reflect? by ciscoeng · · Score: 5, Funny

    No, no. You're thinking of C#!

    1. Re:Reflect? by ari_j · · Score: 4, Informative

      Ultimately, the only good try/catch 22 joke is the one about not making one.

    2. Re:Reflect? by Xiph · · Score: 2, Funny

      Yes, but those are the Exception

      --
      Blah blah sig blah blah blah irony blah blah
  3. the best. by bhcompy · · Score: 3, Informative

    My first language and I wish my only. I don't know if it is because it was my first, but it's the only one that I feel like can accomplish everything I need in a very logical and clean fashion. Java comes close because it feels close, but the extra layer of syntax pisses me off. Anyways, I remember the project in high school that I was working on when it clicked in my mind as a language I can read rather than a bunch of mumbojumbo that I had to try to interpret. Thank you, recursive merge sort project.

    1. Re:the best. by ledow · · Score: 4, Interesting

      I grew up with C and various other languages (I actually learned Z80 assembler after BASIC but before anything else) and I was forced to do Java for university despite the fact that I never attended a single "Programming in Java" lecture for two years and just downloaded the coursework and submitted it online the same day.

      I can't stand C++, it's all but unreadable to me. I'm not saying that C is always readable but C++ makes it much easier to create a mess and jumping into any large C++ project is more an exercise in reading than doing (sometimes that can be a good thing, sometimes that just gets in the way of what should just be a simple fix). And in the end it's just a clever macro / preprocessor trick over C99 to turn various "objects" into sets of function pointers that get called at creation / destruction. I honestly find C++'s syntax quite hideous, and I always thought that Java did a slightly better job at it. The trouble with Java is, unfortunately, far too much verbosity for some very simple things.

      I wouldn't necessarily recommend C to a beginner either but if you're intent on starting down the C++ line, you do actually have to learn 99.9% of C before you ever really understand anything "C++" in a given program. Thus it's a nice *extension* to a language but I don't like it being classed as a language in itself. It is "C with classes", after all.

      It very much depends where you start, I suppose, but I'm loathe to recommend anyone to start with either C or C++ until they know they want to program and will enjoy doing it.

    2. Re:the best. by betterunixthanunix · · Score: 4, Interesting
      C++ was my first language too, and until I started teaching it to other people, it was my favorite. Then I saw all the things that make no sense in C++, which never tripped me up because I happened to have been using the language for so long. I also noticed that a lot of idioms and design patterns that I used to think were really cool hacks were just ways to avoid serious design flaws in the language itself.

      What really killed C++ for me was when a student created a situation like this:

      std::string somefunction(){}

      The fact that such a thing can compile is a glaring error. A function that declares a return type should have a return statement in it, and that should be beyond question. In C, failing to actually return will cause you to have corrupt data; in C++, it can cause a crash, when a temporary object that was never created is destroyed (and happens to have a virtual destructor, which is common).

      It is true, there is no on right language, but on the flip side, there certainly are languages that should be avoided if possible, and I would say that C++ is one of them. I understand that there is a lot of legacy code and that using C++ is often unavoidable, and I have found myself in that situation, but if I were starting a new project with a fresh codebase, C++ would be pretty far down the list of languages that I would consider.

      --
      Palm trees and 8
    3. Re:the best. by Jorl17 · · Score: 2, Insightful

      I was thirteen when I learned how to program. I jumped right into C++ and never looked back. Only later did I dive deeper in the machine with Assembly. Learning Assembly was on par with learning C itself. For me, "C itself" are the lower-level components that C++ programmers can easily avoid. These days I pick C++ when I can, but I do just fine with C. I only miss templates and operator/function overloading, because I can create most of the rest given some time (even polymorphism can be done to a certain degree). C has the advantage of avoiding implicit constructors and destructors.

      Sometimes, though, it's just simpler to go with Python, Ruby or (death coming) Perl. But I think that *real* projects use either C or C++. I do not go deep into C# and all other shitty C-ish things. They may be conquering the market, but I curse the fucktards who started using it and promoting it.

      --
      Have you heard about SoylentNews?
    4. Re:the best. by The+Moof · · Score: 5, Informative

      std::string somefunction(){}

      The fact that such a thing can compile is a glaring error.

      Here's something interesting: Visual Studio wouldn't compile it for me (error C4716, complains about no return value, as you had expected), but it compiled on my FreeBSD box without any complaints. Perhaps this is more of a compiler problem than a C++ problem.

    5. Re:the best. by betterunixthanunix · · Score: 2, Informative

      Actually, if you look at the standard, it is not defined. The standard says what a return statement does, and it was what a function declaration should mean, but it says nothing about functions that have a non-void return type being required to have a return statement in the function body. The fact that Visual C++ won't compile that code means that (1) Visual C++ implements a language that is not exactly C++ and (2) Visual C++ corrects an error in the C++ standard. On the other hand, g++ does not try to correct errors in the standard; in fact, on at least one occasion, they have relied on omissions to justify changes to their implementation of the STL (specifically, they changed the implicit include structure, which is not defined in the standard, and which caused a lot of code to break; the right way to do things in C++ is to explicitly include all headers and never rely on implicit includes, but there are certain common implicit include structures that people have come to rely on, like fstream implicitly including iostream).

      --
      Palm trees and 8
    6. Re:the best. by Chris+Burke · · Score: 3, Insightful

      Uh g++ catches that error for me. Though on the other hand, I consider -Wall -Werror to be basically non-optional arguments.

      --

      The enemies of Democracy are
    7. Re:the best. by Chris+Burke · · Score: 2, Insightful

      Except what? It means g++ is essentially doing the same thing as Visual C++ -- fixing problems with the standard in logical ways. The subset of C++ where you can't have a non-void function not explicitly return anything is a good subset of C++.

      Obviously I'm taking it as given that the C++ standard has flaws. :)

      --

      The enemies of Democracy are
    8. Re:the best. by martyw · · Score: 5, Insightful

      C++ is about freedom, features and performace. That is what makes it special and what matters in producion environments.

      Objective, generic, functional -- its all there and accompained with the best preprocessor, macros and code generators by leading Intel, Microsoft, AMD and even Apple C++ compilers, but again the most important thing is that nothing is really forced upon you. No "automatic memory manager" or other "nany" and "dumb things down" features that create artificial limits, slow execution, unpredictable behavious and most importantly do not restricts you to somebody's elses narrow minded coding practices.

    9. Re:the best. by Sancho · · Score: 3, Insightful

      The fact that Visual C++ won't compile that code means that (1) Visual C++ implements a language that is not exactly C++

      I don't understand. If the behavior is undefined, doesn't that mean that it's up to the compiler to decide what to do in those cases? That doesn't mean that VC++ implements a language that is not exactly C++, it means that it chose to throw an error when this particular undefined behavior occurs. A compiler which doesn't throw that error is still deciding how to handle behavior undefined by the standard.

    10. Re:the best. by ultranova · · Score: 5, Interesting

      While it's great to know other programming languages, learning a completely different language for the sole purpose of getting used to programming in general instead of just learning the language you want to learn seems like a waste of time.

      If you're new to programming, start with line-number Basic. When you start inventing weird workarounds for the weaknesses of that language - namely, the lack of stack - graduate to C and the world of Block Programming. When that starts seeming small to you, graduate to C++/Java.

      The thing is, each and every programming paradigm has been invented to solve problems. You can't really understand it if you don't understand the problem(s) it was invented to solve, and those problems are really only apparent once you push the language to its limits and try make up your own ways to escape them.

      And hey, who knows, maybe you'll invent something better.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    11. Re:the best. by HonIsCool · · Score: 5, Informative

      What you are saying is not correct. The C++ standard says:

      "6.6.3 The return statement
      [...]
      A return statement without an expression can be used only in functions that do not return a value, that is, a function with the return type void, a constructor (12.1), or a destructor (12.4).
      [...]
      Flowing off the end of a function is equivalent to a return with no value; this results in undefined behavior in a value-returning function."

      It is perfectly legal for a compiler to issue a warning for this or even an error. I consider a compiler refusing to compile it a superior compiler.

      --
      "Give me six lines of C++ code written by the most competent programmer, and I will find enough in there to hang him."
    12. Re:the best. by GreatBunzinni · · Score: 3, Informative

      C++ was my first language too, and until I started teaching it to other people, it was my favorite. Then I saw all the things that make no sense in C++, which never tripped me up because I happened to have been using the language for so long. I also noticed that a lot of idioms and design patterns that I used to think were really cool hacks were just ways to avoid serious design flaws in the language itself.

      What really killed C++ for me was when a student created a situation like this:

      std::string somefunction(){}

      The fact that such a thing can compile is a glaring error.

      If you had invested enough time to learn the language well enough to get to a position that you are competent enough to teach others how to use it then you would know that that is indeed a glaring error. For example, if you take the time to check out ISO IEC-14882 (i.e., the international standard which defines the C++ programming language) you will eventually stumble on section 6.6.3 - the return statement. In that section you can read the following definition:

      Flowing off the end of a function is equivalent to a return with no value; this results in undefined behavior in a value-returning function.

      If you also aren't familiar with the concept of "undefined behavior", then you can read up regarding that on section 1.3.12 - undefined behavior, where you can find the following quote:

      behavior, such as might arise upon use of an erroneous program construct or erroneous data, for which this International Standard imposes no requirements. Undefined behavior may also be expected when this International Standard omits the description of any explicit definition of behavior. [Note: permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (with or with-
      out the issuance of a diagnostic message), to terminating a translation or execution (with the issuance of a diagnostic message).

      So you see, what you tried to define as "not making sense in C++" is nothing more than ignorance of the language associated with the use of a compiler which fails to work well in this particular scenario. The standards may be a bit permissive in not declaring this to be illegal but the only parties dropping the ball are the ones in charge of specific compiler projects and/or ignorant users who fail to understand both this basic aspect and how to properly configure their compiler of choice.

      --
      Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
    13. Re:the best. by Xtifr · · Score: 5, Funny

      ...the slowest sorting algorithm

      Bubble sort's not even close. The shuffle sort beats it hands down:

      do {
          random_shuffle(container);
      } while (!sorted(container));

      The initial shuffle helps avoid good performance even when the data is pre-sorted. :)

    14. Re:the best. by Gadget_Guy · · Score: 4, Insightful

      What really killed C++ for me was when a student created a situation like this:

      std::string somefunction(){}

      After all that discussion about whether it really is a problem with the language specification, I have to say that this example is the lamest reason to damn an entire programming language. It is like damning staplers because they shoot staples into your face when you hold it backwards. Here's a tip: don't do that.

    15. Re:the best. by b4dc0d3r · · Score: 4, Insightful

      That's exactly how I learned, and probably a lot of the pro coders. I started with GW-Basic, turbo pascal, visual basic, then hit a wall. Why won't my crc-32 work quickly? Use a .dll in C. So I learned C, and had some polymorphic class type stuff happening.

      Then I decided to learn C++. Bloat I thought, but I basically used C syntax with a few C++ things like new. Then I had a reason to use polymorphism, and I have to say it made the code clean. I learned a lot by looking at various open source code bits, and there is a big difference between well-organized code and poorly organized. Without an intelligent IDE like MSVS 2005, where you can say "find definition" or "find references", C++ can be so poorly laid out that it's incomprehensible. But the compiler can figure it out.

      At the same time I learned C++, I also regressed into x86 assembly and some 6502 as well. Now, when I debug poor C# or SQL performance, people are amazed that I can figure out where the bottlenecks are without even profiling or running the app. Knowing the language helps, but knowing what the computer has to do under the hood is priceless. You don't know the exact algorithm, but you know enough. When you see something like SqlCommandBuilder that magically knows the insert or update or delete commands for each table, you have to be able to know not to use it if you need performance. IF that's not obvious then you should really go back to the basics and unlearn.

      Like when Java came out and everyone called it slow and bloated. Sure it was on some machines, but a lot of it was inefficient string concatenation. Using strings and putting them together instead of using StringBuilder or whatever it's called. Each append required allocation, copy, copy, and a free or two. The language could have helped clarify the intended usage, and examples could have been better, but lots of people don't learn the right way.

      I see way too many posts on forums when I'm searching for information on poorly documented language features that indicate people don't read a single book or have any formal study of the language. They just start copying things they see, and re-use it because it worked last time. And it's even worse now, there are snippets everywhere on how to do things and no explanation on why, or what not to do. If I ever get to be a hiring interviewer, I'm going to have some very basic questions, not a programming exercise. Things like give me an example where a struct would be a better choice and where a class would be better. And for advanced positions, how to write a polymorphic class in C. Top-tier would have to modify the behavior of a program, without having the source code. Replacing me would require doing it without altering the binary.

      In short, learn how the damned thing works and any language will be decent. More importantly, you can decide which one is most appropriate.

    16. Re:the best. by lgw · · Score: 2, Insightful

      C++ is just C without memory leaks. You can use any language to write bad code, and many people think C++ is "C with Classes" and go on to make a mess of it, but it's the ability to have only one line of code in your entire project which frees resources (and then be quite sure that one line has no bugs) which makes it great. Resource management is a constant PITA with C, but it's even less of a worry in C++ done right than it is in C# or Java (unless you genuinely need a non-trivial dynamic cyclic data structure, but somehow that's never come up for me).

      --
      Socialism: a lie told by totalitarians and believed by fools.
    17. Re:the best. by Fourier · · Score: 2, Insightful

      Objective, generic, functional -- its all there and accompained with the best preprocessor, macros and code generators

      LOL

  4. C++. lol. by Anonymous Coward · · Score: 4, Insightful

    And if anyone thinks C++ is the perfect language they're an idiot.

    1. Re:C++. lol. by grub · · Score: 4, Informative


      I don't know why you were modded as a troll. FTA itself:

      Stroustrup: I'll just note that I consider the idea of one language, one programming tool, as the one and only best tool for everyone and for every problem infantile. If someone claims to have the perfect language he is either a fool or a salesman or both.

      --
      Trolling is a art,
  5. read with a fake Scots accent by tverbeek · · Score: 4, Funny

    Only 25 years? When I was in college, we learned C. No "plus plus", no "objective", no "sharp"... just "C".

    Aye, as a matter of fact, I am feeling than a wee bit like Scotty in the TNG episode "Relics".

    --
    http://alternatives.rzero.com/
  6. C++ inside by Dan+East · · Score: 2, Insightful

    I know he said it in jest, but the devices wouldn't have had any C++ in them at all. Only binaries, generated by assemblers, which took output from the C++ compiler. :) A couple layers of abstraction away is all...

    --
    Better known as 318230.
  7. Freedom by FlawedLogic · · Score: 5, Interesting

    I've been writing C++ for 20 of those years and produced an awful lot of performance critical systems code in that time. To this day I find it the most liberating language, whatever is in your mind, you can express it, without the language compromising your intent. I can't see myself moving on until D becomes mainstream, and that may not be before I retire in ten years. I check out all the pretenders as they come and go, nothing else comes close.

    1. Re:Freedom by Rakshasa+Taisab · · Score: 2, Informative

      Except C++ is not slower than C... It's actually equally fast, and can give a lot of performance optimizations with a fraction of the code needed to do the same on C.

      You're just a troll who doesn't actually know C nor C++.

      --
      - These characters were randomly selected.
    2. Re:Freedom by BravoZuluM · · Score: 3, Insightful

      I have been writing with C++ for 20+ years as well. Started with cfront in 87.

      I'll second what Flawed Logic just said. I know and use other technologies as necessary, i.e. PHP for web development, Python for scripting...ect. But for embedded and desktop, C++ rocks. Use a framework like QT with the language and you can be every bit as productive as C#. When developers talk about all of the pitfalls of C++, it just tells me that they lack design principles and discipline. I learned object orient design from Neil Goldstien at Apple Developer University. I just bought his book, "Objective C for Dummies" (never stop learning) and he conveys some of his coding principles in that book. Those ideas have served me well. I also learned C++ at Apple Developer University. I don't remember that instructor, but if I dug through the boxes in the garage, I'm sure I could find the course work. That guy rocked and taught the principles and techniques needed for coding sanely. I can't remember that last time I referenced a null pointer, double dereferenced a pointer, over wrote the stack or other things that people complain about C++. If you do these things, you have not developed a consistent set of rules of engagement. Yes you can have garbage collection but I find I just don't need it. People often ask how I get my programs to run so fast. C++ on today's processors are blinding fast. If someone were to say that they must not have been very complex application, I would tell you that they were consumer applications for large companies: Intuit, Wind River; Qualcomm, Sony Entertainment and others. (I was a contractor.) Many of you used applications that I wrote...along with other talented people.

      What I see today are developers learning a niche and then railing against anything that might threaten that niche. What is lacking is passion and the desire to learn different technology solely because it is fun. The company I am currently has Java guys who insist that Java is the end all and be all. We have C# guys who insist that the language is the end all and be all. We have Python guys who swear it is the only language one needs. When I hear the language wars between them, I just sense that maybe they do it for the money, not because of the joy of it.

      If you find yourself here pontificating that your language is superior to another, maybe technology isn't your thing.

    3. Re:Freedom by theCoder · · Score: 2, Insightful

      Because C and C++ are enabling, not disabling, languages. And while 99% of the time it's a bad idea to do something (like write a custom allocator for a class), occasionally, it is the right thing to do, and you're glad to have that option.

      --
      "Save the whales, feed the hungry, free the mallocs" -- author unknown
  8. Happy Birthday by Lord+Lode · · Score: 2

    Yay, happy birthday, my favorite language :)

  9. The "Right Problem" by Anonymous Coward · · Score: 4, Insightful

    Sometimes, it is more important to have the right problem than the best solution.

    This is certainly true in more ways than he intended. C++ is as awful as it is useful: Extremely. I will remember this quote next time I have to make an implementation recommendation: "C++ is the right problem for this job." Fucking terrible syntax, loaded with gotchas, requires inordinate amount of expertise to avoid subtle errors--and utterly indispensable when a high-performance general purpose programming language is needed.

  10. For some critical views of the language... by leonbloy · · Score: 5, Interesting
    1. Re:For some critical views of the language... by turgid · · Score: 4, Funny

      My favourite quote: c++; /* this makes c bigger but returns the old value */

    2. Re:For some critical views of the language... by shmlco · · Score: 3, Insightful

      The "Why C++ sucks" author is an idiot.

      He states, "In Stroustrop's mind, making C++ compatible with C was instrumental, crucial to its success." And then tells you why it's a bad thing.

      But, as someone who actually lived through that time frame, I'm here to tell you that he misses the point completely. C++ compatibility was in fact instrumental to it's success.

      Why? Because C++ was originally a preprocessor that converted everything to C, and then fed the C code to the C compiler. And almost EVERY platform had a C compiler. By making it compatible, he got many C-language adherents to try it, and he got it on every platform so they could do so.

      --
      Any sect, cult, or religion will legislate its creed into law if it acquires the political power to do so.
  11. A tool for when you need to get the job done by shutdown+-p+now · · Score: 3, Interesting

    C++ - the language which everyone loves to hate. Every time there is a story posted about it on /. (or any other technical forum), you see all kinds of posts ranting about how crappy it is, how Objective-C (or whatever is the fad of the day) is so much better etc.

    And yet - it is still the language in which most desktop software and games are written to this day, and this doesn't show the signs of changing. Not only that, but some of the biggest and most prominent FOSS projects - Firefox, OpenOffice, KDE - are written in it.

    Ever wondered why?

    1. Re:A tool for when you need to get the job done by betterunixthanunix · · Score: 5, Insightful

      C++ is popular for the same reason Windows is popular (and in fact, Windows' popularity probably fuels a lot of the popularity of C++): it is widely deployed, people know it, and there is a lot of legacy code that depends on it. Popularity does not make a language good, and I think we have enough examples: COBOL, FORTRAN, C++, etc. C++ has a number of glaring omissions from the standard, and worse yet, things in the standard that are now idiomatically avoided (see Effective C++ and Effective STL if you are interested -- auto_ptr certainly comes to mind). There are some really great languages out there, which just don't have the same non-technical advantages that C++ enjoys, and therefore never became popular among mainstream programmers.

      --
      Palm trees and 8
    2. Re:A tool for when you need to get the job done by Abcd1234 · · Score: 2, Insightful

      Ever wondered why?

      Tradition, momentum, and the fact that it occupies a very specific niche (large, low-level, high-performance applications). But taken on its own, you could do far far better than C++.

      Hell, by your logic, Windows must be the greatest operating system in the history of computing.

    3. Re:A tool for when you need to get the job done by Anonymous Coward · · Score: 2, Insightful

      Ever wondered why, at one point, Full House was the longest running active sitcom on TV? Was it its high quality?

      C++ is the lowest common denominator language, and hence its entrenchment. Large companies, especially, are prone to entrenchment. For the first few years of OS X, Apple's devs all worked on C++ (i.e., Carbon) versions of the APIs before they worked on their Objective-C counterparts because both the Apple devs and outside companies were stuck in the era of C++. Even as they pushed Objective-C and Cocoa, it was prioritizing C++; it takes time to get away from old standards even when there are better options.

      If not for entrenchment, how else can you explain why so many people who hate C++ bothered to learn it? I only learned it because it was prevalent, even though as I was learning it I saw how terrible it was.

    4. Re:A tool for when you need to get the job done by lennier · · Score: 2, Insightful

      And yet - it is still the language in which most desktop software and games are written to this day, and this doesn't show the signs of changing. Not only that, but some of the biggest and most prominent FOSS projects - Firefox, OpenOffice, KDE - are written in it.

      Ever wondered why?

      Completely coincidentally, the set of software (both FOSS and commercial) written in C++ seems to overlap closely with the set of software for which large and prominent security flaws are discovered every month.

      Ever wonder why that is?

      --
      You are not a brain: http://books.google.com/books?id=2oV61CeDx-YC
    5. Re:A tool for when you need to get the job done by pyrrho · · Score: 3, Insightful

      actually, it's because if you know what you are doing you can make it run as fast as C, and access the hardware as easily as free, and also, if you know what you're doing you can make higher level and more flexible abstractions.

      people seem to have an objection to the "know what you are doing" requirement, and seem to think that in C, you don't have to know and the code manifests well. If there is any truth to that... that C code is all nicely organized now, and naturally safe, then it's only because the C programmers have internalized certain idioms and avoided other possible ones... which is what you have to do in C++ as well to use it well.

      the idea of a language which works well without knowing what you are doing is laughable to me. The illusion comes, for example, from languages where you can build a robust web server in five lines (or whatever)... yes, because it has a webserver built in! if you are going to do something besides say "run this program which was already written", then you need to understand logic and machines. There is no way around that.

      C++ can be made as fast as C, don't deny it because I can write a C++ program that IS C. So it's a truism. That means you only need any feature that imposes any performance hit if it saves you some other way, like protecting memory or allowing one to save time in what is actually the most precious resource, developer time.

      --

      -pyrrho

    6. Re:A tool for when you need to get the job done by sjames · · Score: 2, Funny

      But keep in mind the joke "Eat shit! A trillion flies can't be wrong!"

  12. Doom by Purity+Of+Essence · · Score: 5, Informative

    So, for me, the main satisfaction comes from interesting and challenging applications that just might not have been done without C++, or possibly been delayed for many years for lack of a language suitable for demanding real-world applications. ... Videogames like Doom

    Doom was written in C, not C++.

    --
    +0 Meh
    1. Re:Doom by Purity+Of+Essence · · Score: 2, Insightful

      Except when it isn't. Like the vast majority of iPhone/iOS stuff that is written in Objective-C, and every id game released before Doom III.

      I'm not saying C++ isn't damn near ubiquitous, but the guy specifically suggested that Doom wouldn't have been possible without C++, and that's demonstrably bullshit.

      --
      +0 Meh
  13. "replacement language for C" by Megaweapon · · Score: 2, Insightful

    trollface.jpg

    --
    I'm sure "SlashdotMedia" will improve on all the wonders that Dice Holdings blessed us all with
  14. Alan Kay said it best... by RocketRabbit · · Score: 2, Insightful

    Alan Kay said "Actually I made up the term "object-oriented", and I can tell you I did not have C++ in mind."

    C++ seems like an awful stopgap solution that got out of control.

    1. Re:Alan Kay said it best... by russotto · · Score: 2, Funny

      C++ seems like an awful stopgap solution that got out of control.

      Yeah. And then they added templates.

  15. Almost a great language. by 91degrees · · Score: 3, Interesting

    I think I'd actually like the language if it didn't try to do so much.

    Adding classes to C was great. Operator overloads are really useful, virtual functions mean you can frequently avoid C's rather cryptic function pointer syntax. There are so many clever tricks you can do with scoping that makes C++ extremely useful.

    After that things start to get a bit nasty. Template programming seems like such a nice idea, but it's so cryptic, and totally unreadable - and why use the triangular brackets!? . The syntax to differentiate pre and post increment seems completely arbitrary, and the headaches caused by multiple inheritance and default parameters make me wonder if they're really worth the trouble. The try/catch construct is also useful but it feels so unwieldy.

  16. Coders fault - Not the language by AnonymousClown · · Score: 4, Insightful

    I can't stand C++, it's all but unreadable to me.

    That's because just about every C++ coder wants to be the guru (and maybe find the error that gets the $2 check from Bjarne - I actually saw one and the guy who got it framed it!) so, what do they do? Ever frick'in chance they get, they have to use some esoteric feature of the language in their development regardless if it's appropriate - I've done it too. For example, how many of you fellow C++ guys made a template class even though the class would only deal with one data type for ever and ever and ever? Or overloaded an operator just for the sake of overloading it - operator overloading back in my day was the most over used and abused feature in C++.

    When I got over the guru thing, I always tried to keep my code well documented and used features sparingly.

    For the record, templates can be awesome such as when using the STL - that saved so much grunt work!

    --
    RIP America

    July 4, 1776 - September 11, 2001

    1. Re:Coders fault - Not the language by JamesP · · Score: 4, Insightful

      AMEN TO THAT

      C++ is like barbecue sauce. Too much and it will ruin everything.

      One of the most important things in a C++ project is setting coding style and clear rules of what's ok/not ok.

      So you don't have 10 levels of inheritance, 'creative use' of STL, etc, etc

      --
      how long until /. fixes commenting on Chrome?
  17. What I want to know is... by Black+Art · · Score: 5, Funny

    Does Bjarne Stroustrop think of women as objects?

    --
    "Trademarks are the heraldry of the new feudalism."
    1. Re:What I want to know is... by physburn · · Score: 2, Funny

      but men fit even less, because function dick(), changes from private to public to not function, depending on the value of the blood alcohol variable.

    2. Re:What I want to know is... by Bazouel · · Score: 4, Funny

      Only if they don't have class ;)

      --
      Intelligence shared is intelligence squared.
  18. Programming Machismo by gmurray · · Score: 2, Insightful

    I do believe that anyone that claims to actually like working with C or C++ is either

    1) Unfamiliar with any languages that don't let you shoot yourself in the face so easily.
    2) More like a machine than a man.
    3) Trying to show off his "hacking skillz".
    4) Being overly nostalgic.
    5) Hasn't actually used C or C++ in about a decade.


    IMHO using C or C++ when not necessary displays a depressing amount of machismo and masochism. Why do it to yourself?

    1. Re:Programming Machismo by rbarreira · · Score: 2, Interesting

      Could you explain concretely what you like about working with C?

      I like working with C because it gives me almost all the performance of Assembly language and almost all (or for many applications, all) the ease-of-use of higher-level languages. It's also good to know that whatever new machines or architectures pop up tomorrow, there is bound to be a good C compiler for it, which is more than you can say about most other languages.

      Just glad I don't need to read their code!

      I don't see how well-written C code is so much harder to read than well-written code in Python, Java, or whatever...

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    2. Re:Programming Machismo by gmurray · · Score: 2, Funny

      There's that machismo again. Zip your pants back up, I don't have a ruler on me.

    3. Re:Programming Machismo by rbarreira · · Score: 2, Insightful

      Using C because its "more efficient" is like making tons of micro-optimizations before you even know where your performance problems are.

      No, it is not like that at all. Especially since C already gives you most of the features that make higher-level languages easy to use (variable names, records, control structures etc.). So you're getting more efficiency without making extreme efforts (unlike what your analogy would imply).

      Just as early optimization is bad, I also consider early "pessimization" to be bad, and in many cases you already know from the start that your application will have to be efficient.

      It just wastes time and means you eschew the use of more appropriate tools for the task at hand.

      What makes you think that there are more appropriate tools for the task at hand? Sure, for some tasks there may be. But not for all tasks, and I think we're straying a bit from the original point which is that C can be nice to work with. No one's saying that it's always the best choice.

      But I think a sensible language should at least try to discourage it.

      I'm not so sure. Bad programmers always find ways to shoot themselves in the foot, no matter how much the language tries to cripple their efforts.

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
  19. "Some surprising revelations" by Dystopian+Rebel · · Score: 2, Interesting

    TFS: "There's some surprising revelations in here, too, as his portable computer runs Windows"

    Very well, I am a long-time supporter of FOSS too, but I'll feed your troll: How is BS's use of M-Windows a surprise?

    Is it because M-Windows has bad C++ development tools?

    Is it because M-Windows is not the dominate OS?

    Is it because C++ should only be used in FOSS?

    Is it because BS should share your opinions or be damned?

    --
    Rich And Stupid is not so bad as Working For Rich And Stupid.
  20. The problem with C++ by RzUpAnmsCwrds · · Score: 5, Insightful

    C++ is successful for one big reason: it provides most of the advantages of C with the conveniences of an object-oriented language. Performance is excellent (close to C, which with a good compiler is close to hand-written assembly in most cases) and there's enough capability that you can write just about anything in it, including things that you would never consider writing in manged languages (like device drivers or the VM for those managed languages).

    The problem is that the developers of C++ have trouble saying "no". There are a bunch of C++ features that aren't really necessary, but that exist either out of legacy or because someone thought it would be a good idea.

    Look at Google's C++ style guide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Inheritance

    Like most users of C++, Google uses a severely restricted subset of the language. The thing is, most of what Google has left out is quite frankly unnecessary for 99.9% of C++ users. But we're all stuck with it anyway.

    Once you get past some of the C-legacy anachronisms and restrict C++ to a small subset of its functionality, it's actually a nice language. The problem is that we can't take things out at this point.

  21. It was all a joke by oracleguy01 · · Score: 2

    It seems appropriate to bring up that C++ was all one big joke: http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html

  22. Boggle. Is That Really Linus??? by Anonymous Coward · · Score: 2, Insightful

    I've never actually read anything written by him. He sounds like some dumb 15 year old high school programmer.

    Boggle.

  23. Re:Objective C by Anonymous Coward · · Score: 5, Interesting

    I think the thing that puts a lot of people off ObjectiveC when they come across it the first time is unfamiliar syntax for calling a method. Ironically this is one of it's greatest strengths! In objectiveC function polymophism is not determined a 'signature' created by the argument "types" (which is an idiotic way to do it since it's ambiguous), but rather by the argument labels. That is, the objectiveC method labels every argument with a variable name, not it's type. For example consider the cosine() function. ObjectiveC lets you effectively says Cosine(Radians=3.14159) and Cosine(Degrees=180.0) and have those be polymorphic even though both arguments are floats. In C++ if you want to do that you'd have to create a different typedef for every argument. yuck.

        Moreover, ObjectiveC does not actually determine which method gets called at compile time. it can do it at load time with late binding (like Java) or it can do it at runtime! this is because the object that get's the message can introspect the calling args and decide how to respond to it. You get all these Java-like advantages but run a C-like speed. Nifty.

    This is not to say that ObjectiveC is untyped like python keyword args, but rather that you have the benefit of typing and labeling due to it's more versatile syntax. It's just looks funny the first time you see it.

    At this point someone always says you can do that in C++ to and then produces some archane C++ way of doing that. Yes, well you can do that in BrainFuck too since it's turing complete as well. What matters is how simple you can make that. The beauty of ObjectiveC is that it is a very very thin layer on C that gets you all the things you really wanted in an object oriented language without the crap that makes it hard to use and debug.

  24. Ada Programming by Ada_Rules · · Score: 2, Insightful

    There certainly is no perfect language but I find any programmer that really spends time learning Ada, or Python or other language really well ends up being a better C++ programmer in the end too. Brief interludes don't really cut it either.

    --
    --- Liberty in our Lifetime
  25. the c++ mentality by larry+bagina · · Score: 2, Interesting

    Brad Cox liked C, but it was missing OOP. So he created Objective C, a pure superset of C that embraced the C-ness but added a smalltalk inspired runtime and OO.

    Bjarne Stroustrup wanted to create a new OO (or whatever) language, but he knew that creating an entirely new language was a dead end. He hated C, but it was popular, so he embraced and extended.

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

  26. Running with scissors and suckers on ice by blunte · · Score: 4, Insightful

    I won't bother speculating why C++ became dominant (any more than I feel like rehashing VHS vs BetaMax), but I will say this: any language that needs a series of books explaining how NOT to use the language (lest you create obscure bugs) is an inherently flawed language.

    With assembly there's an excuse - you have no boundaries (no pun intended). You realize you're operating on bare metal, or at least one step above it. But with C++ you have this belief that you have the illusion of power and safety, but the reality is you have a jumble of constructs and tools that can easily be used wrong (and often are by novices and intermediate developers).

    I daresay you could teach an intermediate coder how to do OO in straight C and get better results than if they were trying to use C++.

    And yeah, I'm in the camp of "Obj-C is better than C++". But then, I like Ruby, Lisp, Clojure, and Scala too. C++ really needs to die. Any further energy spent on C++ needs instead to be put into JVM and other abstraction technologies.

    --
    .sigs are for post^Hers.
  27. Re:Objective C by Anonymous Coward · · Score: 2, Informative

    Cosine(Radians=3.14159) and Cosine(Degrees=180.0)

    Nothing prevents from having that exact same syntax in C++, along with many different possible others (whatever is a valid C++ expression).
    C++0x also allows the nicer Cosine(3.14159_Radians) through user-defined literals.

    You are making the grand parents point for him. As he said, You are forcing the polymorphism via typedefs. Your Radians and Degrees are no longer simply floats. What you really meant to do is use a label not a type-- but since there is no syntax for that in C++ you have to use a crescent wrench as a hammer. As the parent pointed out you can do that but it's not simple and does not enforce self documenting code.

  28. Brings back memories... by krisamico · · Score: 3, Insightful

    Bjarne and the Community's creation was the bona fide beginning of my career. When I started, I thought I was a 7 in C++. Several years later, I was a 5. I wrote my best and worst code in the language, over 15 years, and I am still running into issues in the language that challenge me today. C++ helped me learn a lot about myself along the way, and I am grateful to Bjarne and the Community at large for that. A good article and interview, if not a tad brief.

  29. Re:Relative by cheesybagel · · Score: 2, Funny

    Depends on which assembly you are using. If it is X86 assembly, sure, it is baroque.

  30. Re:Objective C by Haeleth · · Score: 4, Interesting

    You get all these Java-like advantages but run a C-like speed.

    Right. Because, by the divine power of Saint Jobs, Objective-C is magically able to do late binding and introspection for free.

    Back in the real world, the speed difference between Objective-C and Java is pretty negligible.

  31. Re:Objective C by Haeleth · · Score: 4, Insightful

    Your Radians and Degrees are no longer simply floats.

    Why on earth would you want them to be? They aren't the same type of data. If you add 45 degrees to pi radians, the answer should not be approximately 48.142.

  32. Re:Relative by russotto · · Score: 2, Insightful

    C++ seems kinda kludgy. Until you start writing programs in assembly. After that C++ looks elegant.

    Having written both, I disagree. I will grant you most of my assembler has NOT been x86.

    C++ is a disaster on many levels. Syntactically, it's obviously so; when a simple loop through an STL vector of int is
    for (std::vector::const_iterator citer = myvector.begin(); citer != myvector.end(); ++citer)
    {
          switch (*citer) { // blah
          }
    }

    Semantically it's full of land mines. Copy and conversion constructors called when you least expect it. Temporaries galore. Idioms that work, but would be inefficient if compiler-writers hadn't developed specific work-arounds (RVO, NRVO). Byzantine rules about declaration and definition and scoping. The list goes on.

  33. Re:Objective C by pizzach · · Score: 2, Informative

    You get all these Java-like advantages but run a C-like speed. Right. Because, by the divine power of Saint Jobs, Objective-C is magically able to do late binding and introspection for free. Back in the real world, the speed difference between Objective-C and Java is pretty negligible.

    The reason people say this is because you can use straight C when the extra speed is paramount. Can you run inline C code in java without needing the interpreter? Using straight C code inline in Obj-C is a bit like using Assembly inline in C. It's there when you need it.

    --
    Once you start despising the jerks, you become one.
  34. Re:Objective C by larry+bagina · · Score: 2, Interesting

    that would be [someObject drawSquareX: 100 y: 120 width: 30 height: 40] (not actually much of a square) or [someObject drawRectangle: myRect]

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

  35. C++ actually faster than C by pslam · · Score: 4, Informative

    Except C++ is not slower than C... It's actually equally fast, and can give a lot of performance optimizations with a fraction of the code needed to do the same on C.

    It's even better than that. There's extra type checking and tighter rules on aliasing in C++ (unless you turn them off), so it can actually generate faster code. If you trivially convert a C program to the slightly less relaxed rules of C++, you should expect at least the same performance (if not, file a bug with your compiler provider), and often better.

    I agree with the sentiment that anyone who thinks C++ is slower then C understands neither. It perfectly demonstrates their lack of understanding.

  36. It's None of Those Things by Senjutsu · · Score: 3, Insightful

    It's because Bjarne Stroustrup spent 23 years at Bell Labs, and ran the Large-Scale Programming Research Department there.

    Bell Labs was the birth-place of Unix, and was always Unix central. Anyone even cursorily familiar with these facts would be a bit surprised to see someone who was so close to such a Unix stronghold for so long running a non-POSIX compatible system for day-to-day use.

  37. The Real Headline by brsmith4 · · Score: 2, Funny

    Bjarne Stroustrup Reflects On 25 Years of C++: My bad

  38. Good leaders are not *always* good leaders. by Futurepower(R) · · Score: 4, Insightful

    Unfortunately, although Linus Torvalds is an excellent leader of technology development, he sometimes exhibits unsophisticated social behavior.

    In the linked message from Linus, *YOU* are full of bullshit, he gives good reasons why he doesn't like C++, but he does not fully analyze the entire situation.

    For example, he says "C++ leads to really really bad design choices". That's true in many cases, but C++ programming could be limited to the features that work well. Many of the problems with C++ are caused by programmers using features that they don't fully understand, only so they can get some experience using them. Often, it seems, programmers just want to experiment, and don't care about the long-term end result of what they are coding.

    Another problem with C++ is that, while Bjarne Stroustrop was a good leader when C++ was introduced, he has basically exercised too little power in the last 20 years in making sure the C++ language and libraries developed rapidly enough, and in the correct direction.

    Still, as bad as the situation is with C++, what is better? Java and C# are easily decompiled; both suffer from ugly politics. C++ is better than C in that it helps programmers control the scope of variables, for example.

    When Linus Torvalds says "*YOU* are full of bullshit", he is acting out his anger, he is not acting like a leader. He is not helping make the situation better.

    Unfortunately, the people on whom we rely to be our leaders are not always good leaders. We can, however, be thankful for everything positive they have done for us.

    1. Re:Good leaders are not *always* good leaders. by 21mhz · · Score: 2, Informative

      Note that he was shutting down an annoying newbie who suggested something like reworking the git codebase to use "nice abstractions" to solve no real problem. C++ advocacy on the net seems to be dominated by such newbies, or then they are the gurus who know obscure C++ quirks inside out and have written a book on that.

      --
      My exception safety is -fno-exceptions.
  39. pick your poison by yyxx · · Score: 2, Interesting

    Objective-C is a caricature of Smalltalk, combining all the disadvantages of C with only few of the advantages of Smalltalk. It also lacks pretty much all the advantages of Java: Objective-C is not type-safe, it does not provide runtime safety, it does not provide sandboxing, and it does not allow you to safely load extension modules.

    C++ started out as a simple set of fixes to problems in C, and for the first few years, it was a pretty good tool. That's why it won over Objective-C, which came out around the same time. Eventually, C++ bloated beyond recognition, while Objective-C stagnated from disuse, and that's the state we're still in. There are still a few valid use cases for C++, but I see none for Objective-C.

    What should you use then? As far as languages that you can realistically use, I think the best ones around are C#, Go, Python, and Ruby. There is nothing (zero) new ideas in those languages compared to what's been available for decades and their implementations are mediocre and bloated at best. The evolution of programming languages has been a big, fat disappointment.

    1. Re:pick your poison by Rockoon · · Score: 2, Interesting

      There has still been a bit of refinement in the standard Structured+OO paradigm, with for example Generics (first seen in Ada in 1983, but not to hit mainstream languages until C#/Java, and as templates in C++)

      Many programmers wouldnt want to go without some form of Generics today for any project of a significant size. All that research, when its proven useful, eventually makes its way into something more popular than the languages that pioneered them. The alternatives to generics are either re-inventing-the-wheel, inefficient-runtime-dynamics, or the complete-loss-of-type-safety. Thank you Jean Ichbiah (inventor of Ada!)

      --
      "His name was James Damore."
  40. Re:Objective C by eric-x · · Score: 2, Funny

    How is that superior to -1?

  41. Lables versus typedefs by Anonymous Coward · · Score: 3, Informative

    That was a simple example for economy of words. Let's take a more complex example. Suppose I have an area function that takes inputs like height (H=5) and width (W=6) and length (L=7). In objectC you might write the following where W,L, and H are just floats to get the area of the side of the object:
    [object area width:W height:H]
    simple and you could do that in C++ by typedef W is type width, and H is try Length.
    but now you want the area of the top and bottom:
    [object area width:L height:W ]
    But you can't do that in C++ without casting because L and W are not floats but rather are type defs that don't match their positions.
    But that's not an example of polymophism just using labels instead of type defs which is what you really wanted in the first place, since the values were logically floats and you don't need to proliferate the type defs and make it a typically C++ mess. On the other hand if you really did require type safety then you could give them types.

    THe other thing is that there are a proliferation of ways you might write the call in c++. IN most of these you would just have a list of arguments separated by commas:
    object.area(L,W)
    or
    object.area(W,L)
    Notice there is no enforcement of self documentation here. Can you recall which order the arguments are supposed to be in? L then W or W then L? In objectiveC the labels are enforced automatically.

    People who write in C++ try to make up for the lack of labels by name mangling the method name like this:
    object_area_L_then_W(L,W)
    but there's no consistency in how that is done, and it does not enforce that the arguments are actually in the order required.

    None of this has been about polymoprhism. I was just backing up to show you that trying to use typdefs to do the job of labels is why C++ code is so damn hard to write, debug and read, and has no consistency from person to person. Notice that ObjectiveC is doing this without any bloat: THere is only way way to write the method not a proliferation. We did not have to create some library to hand in maps to fake labels as we would in C++. it's all very natural. The fact that you then get polymorphism directly emphasizes how natural it was: methods with different labels are different methods. No typecasting required. The signatures could be identical.

    1. Re:Lables versus typedefs by goombah99 · · Score: 2, Informative

      Mod parent up. Nice explanation.

      --
      Some drink at the fountain of knowledge. Others just gargle.