Beta

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Bjarne Stroustrup Reflects On 25 Years of C++

timothy posted more than 3 years ago | from the stroustrup-plus-plus dept.

Programming 553

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

cancel ×

553 comments

Sorry! There are no comments related to the filter you selected.

Olde Saying (5, Funny)

Anonymous Coward | more than 3 years ago | (#33900174)



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

Truer words have never been spoken.

Re:Olde Saying (0, Troll)

Anonymous Coward | more than 3 years ago | (#33900620)

Look on the bright side, C++ keeps dilettantes and fudge-packing quiche eaters away from serious projects. [lwn.net]

Re:Olde Saying (-1, Troll)

Anonymous Coward | more than 3 years ago | (#33901046)

Actually, C++ would be a much nicer language if it didn't inherit C's declaration syntax, incestuous preprocessor use or weak type system.

C++ is to C as a turd sandwich is to a turd.

For some reason.... (0)

kellyb9 (954229) | more than 3 years ago | (#33900180)

For some reason, I read that as "Bjarne Stroustrup Comments On 25 Years of C++".

// I had a reply all set to go...

Re:For some reason.... (1)

RDW (41497) | more than 3 years ago | (#33900294)

For some reason I (really!) thought I read 'the now perverse replacement language for C'. I was probably thinking of his earlier interview:

http://www.netfunny.com/rhf/jokes/98/May/stroustrup.html [netfunny.com]

(about which Stroustrup is apparently Not Amused: http://www2.research.att.com/~bs/bs_faq.html#IEEE [att.com] ).

Re:For some reason.... (1)

gerddie (173963) | more than 3 years ago | (#33900950)

For some reason I (really!) thought I read 'the now perverse replacement language for C'. I was probably thinking of his earlier interview:

http://www.netfunny.com/rhf/jokes/98/May/stroustrup.html [netfunny.com]

Nice try, but did you also read it to the end?

"Portable computer" (1)

bonch (38532) | more than 3 years ago | (#33900754)

When was this written, 1978? "Portable computers" are called laptops or netbooks.

Reflect? (5, Funny)

ciscoeng (411359) | more than 3 years ago | (#33900182)

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

Re:Reflect? (1)

Monkeedude1212 (1560403) | more than 3 years ago | (#33900328)

Sometimes I hate being the kind of person who gets those jokes...

You know, when you chuckle, and then the guy across the room asks, "What?". And you say "Oh, just a programming joke" and then you feel bad because it makes you sound smug about it but really you're just saving each other some time by not explaining something that they wouldn't get initially to finally resolve to a joke that wouldn't be so funny after you explain it.

I almost made a try/catch 22 joke, but I think we can all agree those have been overdone.

Re:Reflect? (4, Informative)

ari_j (90255) | more than 3 years ago | (#33900554)

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

the best. (3, Informative)

bhcompy (1877290) | more than 3 years ago | (#33900198)

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.

Re:the best. (1)

kellyb9 (954229) | more than 3 years ago | (#33900224)

Thank you, recursive merge sort project.

That's good and all but Bubble Sort FTW!

Re:the best. (1)

Ethanol-fueled (1125189) | more than 3 years ago | (#33900312)

The only time a bong hit helped me better understand algorithms...

Re:the best. (0)

Anonymous Coward | more than 3 years ago | (#33900260)

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.

Out of the mouths of babes and sucklings...

Re:the best. (4, Interesting)

ledow (319597) | more than 3 years ago | (#33900370)

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.

Re:the best. (2, Insightful)

Jorl17 (1716772) | more than 3 years ago | (#33900476)

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.

Re:the best. (0)

betterunixthanunix (980855) | more than 3 years ago | (#33900520)

I think that *real* projects use either C or C++

Well, there is this:

http://en.wikipedia.org/wiki/Dynamic_Analysis_and_Replanning_Tool [wikipedia.org]

I would certainly call that a "real project." Really, C and C++ are pretty terrible programming languages, with C++ being a bit worse than C, and I say that as someone who also started programming in middle school using C++.

Re:the best. (0, Interesting)

Anonymous Coward | more than 3 years ago | (#33900700)

C is an excellent language when it's used for the purpose it was designed for.

C++ was not designed for any one specific purpose, and so it's never a good language. Occasionally it's the least bad of all the options available.

Re:the best. (0)

zombieChan51 (1862028) | more than 3 years ago | (#33900656)

But I think that *real* projects use either C or C++.

That is a terrible way to view the world. I've worked on several *real* projects that were not written in C or C++. Hell there's quite a bit of popular software out there used in the real world that were not written in C or C++.

Re:the best. (1)

cheekyjohnson (1873388) | more than 3 years ago | (#33900510)

"but I'm loathe to recommend anyone to start with either C or C++"

I see this said often, but I don't really agree with it. 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. Learning that other language probably isn't going to help you learn the syntax of the language you really want to learn. I tried learning other languages, as people often suggest, but in the end it didn't really help me 'get' C++ more. From that point on I merely studied C++, because I feel that that's the best thing to do.

Re:the best. (1)

smallfries (601545) | more than 3 years ago | (#33900698)

Basic, Z80 assembler and Java for university. I sense another 80s child in the room. Put down your copy of Devpac and back away from the keyboard slowly...

Coders fault - Not the language (4, Insightful)

AnonymousClown (1788472) | more than 3 years ago | (#33900704)

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!

Re:the best. (1)

Fnkmaster (89084) | more than 3 years ago | (#33900848)

You should try out D. It's the power of C or C++ with the readability of something like Java or Python, sans Java's forced verbosity (or virtual machine considerations).

It supports templates and operator overloading, but it's got garbage collection (which you can control in a fairly fine-grained way if you want).

You can use C libraries fairly easily, and apparently link with C++ code if you want. You can also export stuff via extern C {} that can be called from standard C code.

I don't have tons of experience with the standard library stuff in D and have just done some toy work in it, but it seems really nice to me.

I learned C++ ages ago when it was relatively new, and I didn't know any better at the time. These days I just hate it. Mostly reading code that other people wrote in it - my own code I can handle.

Re:the best. (5, Insightful)

martyw (1911748) | more than 3 years ago | (#33901012)

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.

Re:the best. (4, Interesting)

betterunixthanunix (980855) | more than 3 years ago | (#33900408)

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.

Re:the best. (0)

Anonymous Coward | more than 3 years ago | (#33900652)

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

Yes, C++ is full of those, and I think people are blind to them because they've never learnt anything better. If the only tool you've ever used is a hammer, you won't understand that there's a radial arm saw that's a much better tool for certain kinds of tasks.

Re:the best. (5, Informative)

The Moof (859402) | more than 3 years ago | (#33900678)

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.

Re:the best. (2, Informative)

betterunixthanunix (980855) | more than 3 years ago | (#33900742)

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

Re:the best. (3, Insightful)

Chris Burke (6130) | more than 3 years ago | (#33900808)

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

Re:the best. (1)

betterunixthanunix (980855) | more than 3 years ago | (#33900828)

Except that:
  1. The standard says nothing about warnings, only errors
  2. The fact that you asked g++ to consider warnings as errors means that you are asking g++ to only accept a subset of C++

Re:the best. (2, Insightful)

Chris Burke (6130) | more than 3 years ago | (#33900902)

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

Re:the best. (0)

Anonymous Coward | more than 3 years ago | (#33900928)

Yes indeed, someone who compiles without /Wall or /W4 can't really be called a C++ programmer... they're relying on obscurity for correct program behavior.

Re:the best. (1)

Moridineas (213502) | more than 3 years ago | (#33900758)

I think I would be tempted to agree that this should be an error, not a warning, but if you use the -Wall flag it's caught.

Re:the best. (0)

Anonymous Coward | more than 3 years ago | (#33900952)

Any C or C++ compiler that doesn't flag that as an error is broken. End of story.

Re:the best. (1)

91degrees (207121) | more than 3 years ago | (#33900712)

Is that legal C++? I'm sure any compiler I've used would give an error there.

Re:the best. (1)

betterunixthanunix (980855) | more than 3 years ago | (#33900792)

Try it with g++:

% cat blah.cpp
#include <string>

std::string func(){}
% g++ blah.cpp -c
%

Or, look at the standard, which is what I did when I first saw this bizarre bug, and yes, the standard says nothing about that code failing to compile (the standard defines errors, not warnings, although at the default warning level, g++ doesn't even warn about that one).

Re:the best. (0)

Anonymous Coward | more than 3 years ago | (#33900770)

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.

Uhhh.... Sorry to break this to you since you "taught" C++. That function doesn't compile. Maybe next time learn the language you are teaching.
"error C4716: 'somefunction' : must return a value"

Also you don't seem to know what you are talking about. C++ is a fine language and it has its place. Depending on the *type* of project with a fresh code base C++ might or might not be appropriate. Based on your whole post and the glaring bias and inaccuracies I don't think you should comment on anything software related.

Re:the best. (0)

Anonymous Coward | more than 3 years ago | (#33900962)

I hear you smoke a mean pole? Can we meet up at the glory hole later tonight?

Re:the best. (0)

Anonymous Coward | more than 3 years ago | (#33900958)

on the other end

std::string somefuntion(){
exit(0);
return someshit;
}

never returns and shouldn't need a return statement.

Re:the best. (1)

Monkeedude1212 (1560403) | more than 3 years ago | (#33900424)

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.

I think its that way with everyone's first language.

I just hate that my first language was VB, because after doing years of C++ and finally getting used to it, it comes back to haunt me when I'm the only one on the team comfortable enough with VB to go through the old VB6 code and figure out why Invoicer A can run functions that will break for Invoicer B.

Well, I'm not the ONLY one who can, but once you get that label as "The guy who is better at it" all that stuff gets dumped on you. You know how it goes.

C++. lol. (4, Insightful)

Anonymous Coward | more than 3 years ago | (#33900202)

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

Re:C++. lol. (4, Informative)

grub (11606) | more than 3 years ago | (#33900240)


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.

Re:C++. lol. (1)

Migala77 (1179151) | more than 3 years ago | (#33900430)

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.

And that coming from the guy who created a multi-paradigm language.

Re:C++. lol. (1)

Abcd1234 (188840) | more than 3 years ago | (#33900598)

Multi-paradigm does not imply "best tool for everyone and for every problem". I'd never write a quick text processor in C++, and I'd never write a kernel in Perl. But I might write a mixture of object-oriented, functional, and traditional procedural code in either one.

Re:C++. lol. (0)

Anonymous Coward | more than 3 years ago | (#33900796)

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

Allow me to demonstrate.

Insightful: "It's a shame that the C++ standard doesn't require that compilers search dependent base classes when looking up non-dependent names. This makes the rare and already very complex task of writing a C++ compiler very slightly simpler, while making the much more common task of writing C++ methods unnecessarily verbose."

Troll: "What kind of moron thinks that it's a good idea to make everyone write this->f() when f is obviously in my base class? Were templates just too damn confusing for you, Bjork?"

Re:C++. lol. (1, Interesting)

Dystopian Rebel (714995) | more than 3 years ago | (#33900802)

The parent is NOT a troll. As others have noted, BS says this himself.

I find one of the most unfortunate things about C++ is that for years a large number of self-important people considered C++ to be the only language that *good programmers* know.

I have sat for interviews that were in sum nothing but quizzes about the arcane features and misfeatures of C++. The interviewers thought that they were showing me that I didn't deserve to work with "geniuses".

What they were really showing me is that I didn't want to work with arrogant primates who had lost their way in the Software Engineering Forest.

Re:C++. lol. (1)

catbutt (469582) | more than 3 years ago | (#33900964)

I agree that C++ is far from perfect, but I do think that we should strive for one language that is the only one you need to know. It may be a long ways off, but I think the inefficiencies of having to learn multiple languages, and having to port code between them, is one of the biggest things holding back progress. I'm sure everyone will disagree with me, but I'd be willing to bet that 25 years from now, 99% of programming (for computers, phones, and whatever devices they have then) will be done in a single language.

To me, it's like the metric system. Sure, using fractional inches might be better for some things, but that is far outweighed by the benefits of having a single unit for length (etc).

That said, I don't think any language in existence today would do it, since none is flexible enough to do both operating systems and dynamic web pages and everything in between. But saying that no language could do both, and do them well, simply shows a lack of imagination.

read with a fake Scots accent (4, Funny)

tverbeek (457094) | more than 3 years ago | (#33900234)

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

Re:read with a fake Scots accent (1)

pjt33 (739471) | more than 3 years ago | (#33900362)

Why would you want a fake Scots accent to do a ripoff of the Four Yorkshiremen sketch?

Re:read with a fake Scots accent (1)

blair1q (305137) | more than 3 years ago | (#33900470)

In my day, you got a fake Scots accent and you liked it.

The Dream Project (1)

oldhack (1037484) | more than 3 years ago | (#33900264)

For job security, that is, would be C++ modules glued together with Perl.

I've got a headache just typing this post.

Re:The Dream Project (1)

shutdown -p now (807394) | more than 3 years ago | (#33900412)

For job security, that is, would be C++ modules glued together with Perl.

If you're really going for job security, I think it would be more advisable to go with Perl modules glued together with C++.

But, really, you can get creative enough with C++ as is. For example, implement Brainfuck using template metaprogramming, then write as much as you can in Brainfuck using those templates.

Re:The Dream Project (1)

obarel (670863) | more than 3 years ago | (#33900552)

The nightmare of every manager: to wake up one day and find that every piece of software in the company is written in whitespace. Talk about job security... "What do you mean 'where is the source code'? This *is* the source code. But I'm here to talk about my raise, actually."

Re:The Dream Project (1)

MichaelSmith (789609) | more than 3 years ago | (#33900810)

For job security, that is, would be C++ modules glued together with Perl.

For real job security use rhapsody to generate the perl and C++ and make everything an object. How's that headache now?

Then what's the point? (0)

Anonymous Coward | more than 3 years ago | (#33900290)

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

They why make a not-really-object-oriented language that seems to be the result of you getting really high and having programmer's munchies -- throwing in every single feature you could think up, no matter whether it fit or was redundant? Why not create something cleaner and with some sense of purpose and editorial discretion?

C++ inside (2, Insightful)

Dan East (318230) | more than 3 years ago | (#33900322)

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

Freedom (5, Interesting)

FlawedLogic (1062848) | more than 3 years ago | (#33900410)

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.

Re:Freedom (1)

blair1q (305137) | more than 3 years ago | (#33900498)

performance critical

Did you say "fast"?

Re:Freedom (1)

FlawedLogic (1062848) | more than 3 years ago | (#33900588)

Ok, I'm a verbose git. But yes - where 'fast' is a critical requirement of the system, or people may die.

Re:Freedom (1)

shmlco (594907) | more than 3 years ago | (#33901058)

How about when systems are hacked and they crash due to bad pointer manipulation and buffer overruns... and people die?

Performance isn't everything.

Re:Freedom (0)

Anonymous Coward | more than 3 years ago | (#33900658)

no, he said " has to be fast"
dumbkopf!

Happy Birthday (2)

Lord Lode (1290856) | more than 3 years ago | (#33900448)

Yay, happy birthday, my favorite language :)

The "Right Problem" (4, Insightful)

Anonymous Coward | more than 3 years ago | (#33900456)

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.

Re:The "Right Problem" (1)

Chris Burke (6130) | more than 3 years ago | (#33900842)

C++ is as awful as it is useful: Extremely.

Ha! That's a pretty great quote there yourself Mr. AC.

For some critical views of the language... (5, Interesting)

leonbloy (812294) | more than 3 years ago | (#33900484)

Re:For some critical views of the language... (4, Funny)

turgid (580780) | more than 3 years ago | (#33900682)

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

Re:For some critical views of the language... (1)

cb123 (1530513) | more than 3 years ago | (#33900716)

For some critical discussion of the "productivity", this recent thread might also be of interest. In the article in question Bjarne claims credit (dubiously IMO) for saving 'years of development time' on any complex project [ Google, DNA matching, etc. ] where people happened to use C++ instead of some alternative. http://www.reddit.com/r/programming/comments/cdncx/linus_about_c_productivity_again/?utm_source=web&utm_medium=twitter [reddit.com]

A tool for when you need to get the job done (3, Interesting)

shutdown -p now (807394) | more than 3 years ago | (#33900496)

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?

Re:A tool for when you need to get the job done (5, Insightful)

betterunixthanunix (980855) | more than 3 years ago | (#33900568)

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.

Re:A tool for when you need to get the job done (1)

AnonymousClown (1788472) | more than 3 years ago | (#33900590)

C++ - the language which everyone loves to hate.

I thought it was Visual Basic.

Re:A tool for when you need to get the job done (2, Insightful)

Abcd1234 (188840) | more than 3 years ago | (#33900684)

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.

Re:A tool for when you need to get the job done (2, Insightful)

Anonymous Coward | more than 3 years ago | (#33900798)

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.

Doom (5, Informative)

Purity Of Essence (1007601) | more than 3 years ago | (#33900514)

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

Re:Doom (0)

Anonymous Coward | more than 3 years ago | (#33900570)

Same difference right?

-Clueless Newswriter

Re:Doom (0)

Anonymous Coward | more than 3 years ago | (#33900690)

Doom was written in C, not C++.

I guess that's what doomed it.

Re:Doom (-1, Troll)

martyw (1911748) | more than 3 years ago | (#33900788)

God of War, Halo Reach, Borderlands, BioShock, Oblivion, Gears of War, Doom III, Unreal Engine, Mafia 2, Counter-Strike (entire Source Engine in fact)

Pretty much every AAA production that sells under top publishers is written in C++ today, no exception. Complete Playstation 3/PSP production tool chain for 1st parties and recomended libraries all C/C++, same on Xbox, same on Wii and Nintendo DS, even iPhone, not to mention all the profession software for Linux and Win/Mac.

Re:Doom (1)

Chris Burke (6130) | more than 3 years ago | (#33901050)

Doom was written in C, not C++.

The primary reason being that back then, C++ compilers were not good enough to produce sufficiently fast code when using any of the things that make C++ worth using over C (heck and a lot of the things that really make it useful like templates weren't even present). Not with the kind of constraints Doom was operating under (getting those graphics on a 386 was something of a miracle, even with all the clever tricks used).

Written in C++? (1)

TejWC (758299) | more than 3 years ago | (#33900522)

Videogames like Doom, ...

Correct me if I am wrong, but I am pretty sure the first Doom was written in C [wikipedia.org] .

Re:Written in C++? (1, Informative)

Anonymous Coward | more than 3 years ago | (#33900560)

So was Doom II, Quake, Quake II, and Quake 3 Arena. All straight C.

Dunno about Doom 3/Quake IV, they haven't released source code for those yet.

"replacement language for C" (2, Insightful)

Megaweapon (25185) | more than 3 years ago | (#33900530)

trollface.jpg

Re:"replacement language for C" (0)

Anonymous Coward | more than 3 years ago | (#33900892)

It's "coolface" you fucking troll.

Alan Kay said it best... (2, Insightful)

RocketRabbit (830691) | more than 3 years ago | (#33900546)

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.

Re:Alan Kay said it best... (2, Funny)

russotto (537200) | more than 3 years ago | (#33900780)

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

Yeah. And then they added templates.

Another write-only language (1)

rbarreira (836272) | more than 3 years ago | (#33900614)

So that's exaggerating a bit, but even if I enjoyed writing some C++ programs, I still find it hard to dive into C++ source code and understanding what it does.

For example... If you're reading a piece of C code and see a function call, you can find the function definition with a simple textual search. With C++ you have to look at the argument types (due to function overloading), you have to check what the object type due to derived classes, etc. What a mess it is just to find out precisely what code is behind a function call.

It's really a pain in the ass to read C++ code that you haven't written (or maybe even that you wrote some months ago).

The Best Language Is The One You Know The Best (1)

assertation (1255714) | more than 3 years ago | (#33900650)

That statement works as both a positive idea and as a negative one.

The positive being the more capable you are the more time you put in.

The negative being the trend towards techno dogmatism among programmers.

Programmers tend to be afraid of technology they are not used to, so everything that isn't their core thing tends to be labeled as "crap".

I would love to learn more languages........time!

Almost a great language. (3, Interesting)

91degrees (207121) | more than 3 years ago | (#33900662)

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.

Re:Almost a great language. (1)

Zumbs (1241138) | more than 3 years ago | (#33901000)

Template programming seems like such a nice idea, but it's so cryptic, and totally unreadable - and why use the triangular brackets!?

Template programming is a great idea, and it is very useful in a number of cases. After heavy usage of C++ templates, I have been programming a bit in Java using generics, and, well, there are just so much stuff I can't do with generics. But I agree on your point about readability. The worst part, however, is the learning curve when you start out with your first template heavy project. Figuring out what functionality some_random_type has can be quite a challenge, particularly when there are typedefs all over. Compiler output can also be a challenge, but has improved significantly over the last few years.

Re:Almost a great language. (1)

loufoque (1400831) | more than 3 years ago | (#33901026)

Template programming seems like such a nice idea, but it's so cryptic

It's exactly the same syntax as the rest, except you may have to add "typename" or "template" in certain situations to help the parser.

Shocking revelations! (-1, Troll)

Anonymous Coward | more than 3 years ago | (#33900728)

I can't believe that someone with part of a brain admits to using Windows!

Seriously, who cares?

What I want to know is... (5, Funny)

Black Art (3335) | more than 3 years ago | (#33900734)

Does Bjarne Stroustrop think of women as objects?

Programming Machismo (2, Insightful)

gmurray (927668) | more than 3 years ago | (#33900776)

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?

Re:Programming Machismo (1)

rbarreira (836272) | more than 3 years ago | (#33900870)

I like to work with C and I don't think any of that applies to me.

Re:Programming Machismo (1)

gmurray (927668) | more than 3 years ago | (#33901018)

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

I used to claim the same thing, but after years not being required to use C, in hindsight, I can chalk up every reason I enjoyed it to senseless machismo, and my most concrete memories are of all the time of mine C wasted by not warning of or preventing egregious errors from simple typographical mistakes.

I would never choose C if starting a new project, and it still baffles me that some do. But to each his own I guess :) Just glad I don't need to read their code!

C++ is the Beatles of Programming Languages (1)

wandazulu (265281) | more than 3 years ago | (#33900834)

First there was the "red" album: straightforward rock-n-roll with some interesting wordplay, but with only a few general themes. C++ was the same way: create some objects, work with 'em, pass 'em around. All good.

Then C++ discovered acid and got into its "blue album" phase: multiple inheritance, templates, operator overloading, namespaces. To read C++ now is like listening to the later Beatles: obtuse, baffling, with a fair amount of brilliance that makes you wonder "how did they do that?????" It confirms that there are always smarter people than me if only to be able to make sense of it all...

 

No, you've got it all wrong! (1)

Scarred Intellect (1648867) | more than 3 years ago | (#33900894)

Bjarne Stroustrup hated [erenkrantz.com] C++! Any day now, C will rise again and be the dominating force!

"Some surprising revelations" (2, Interesting)

Dystopian Rebel (714995) | more than 3 years ago | (#33900954)

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?

Revelation??? (0)

Anonymous Coward | more than 3 years ago | (#33901008)

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

This is some kind of revelation? The revelation would be if he didn't run any instance of a Windows setup. The submitters bias is being overlayed onto Stroustrup for some reason, but for the sake of the rest of us he should only pose it as his (the submitters) revelation rathar than giving what seems to be a false impression that Stroustrup is anti-windows in some way.

C++ Is Usually Taught Incorrectly (1)

MichaelCrawford (610140) | more than 3 years ago | (#33901010)

Another poster lamented C++ as being a terribly, messy language, and said it was nothing better than C with Classes.

If all you write is C with Classes, you'll get a leaky mess full of crash bugs that you'll never be able to do away with.

But if you write C++ the way C++ wants to be written, it's actually a very easy language to write leak-free, bug free code with. Memory management in particular is very easy with RAII - Resource Allocation Is Initialization. Smart Pointers are RAII applied to heap blocks, but it should be applied to every allocated resource, such as database locks or file handles.

A while back I wrote a style guide that summarizes much of what I know about C++: Pointers, References and Values [goingware.com] .

The problem with C++ (5, Insightful)

RzUpAnmsCwrds (262647) | more than 3 years ago | (#33901048)

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 [googlecode.com]

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.

It's not the only tool, but it's a good one. (1)

degeneratemonkey (1405019) | more than 3 years ago | (#33901066)

Anyone who outright dismisses C++ as a generally bad language to use in any situation is matched in their ignorance only by someone who swears by C++ as the best solution in every situation. I can't imagine keeping a straight face while using the term "engineer" in any capacity to describe a person made uncomfortable by such a powerful language. Ugly? Yep. Stopgap solution that got out of control? Pretty much. The [i]only[/i] language in its class? Yep. Bad C++ code can be very, very bad. Good C++ code is surprisingly elegant and extremely powerful. Its unique mix of expressive features, performance capacity, programmer flexibility and sheer volume of libraries far outweigh any argument about its semantical shortcomings.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?
or Connect with...

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>