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."

45 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 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.

  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.

  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 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.

    4. 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
    5. 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.

    6. 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.

    7. 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.

    8. 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."
    9. 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.
    10. 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. :)

    11. 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.

    12. 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.

  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. 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 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.

  7. 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.

  8. 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.
  9. 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 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

  10. 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
  11. 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.

  12. 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?
  13. 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 Bazouel · · Score: 4, Funny

      Only if they don't have class ;)

      --
      Intelligence shared is intelligence squared.
  14. 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.

  15. 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.

  16. 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.
  17. 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.

  18. 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.

  19. 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.

  20. 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.

  21. 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.

  22. 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.

  23. 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.