
Bjarne Stroustrup Reflects On 25 Years of C++ 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."
Olde Saying (Score:5, Funny)
C++ is to C as Lung Cancer is to Lung.
Truer words have never been spoken.
Re:Olde Saying (Score:4, Insightful)
Re:Objective C (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.
Re:Objective C (Score:5, Interesting)
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.
Re: (Score:3, 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.
Re:Objective C (Score:5, Insightful)
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.
Lables versus typedefs (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 ca
Re: (Score:3, Informative)
Mod parent up. Nice explanation.
pick your poison (Score:3, 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 t
Re: (Score:3, Interesting)
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-
Re: (Score:3, Funny)
Good leaders are not *always* good leaders. (Score:5, Insightful)
In the linked message from Linus, *YOU* are full of bullshit [lwn.net], 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.
Reflect? (Score:5, Funny)
No, no. You're thinking of C#!
Re: (Score:2)
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 bee
Re:Reflect? (Score:5, Informative)
Re: (Score:3, Funny)
Yes, but those are the Exception
the best. (Score:4, Informative)
Re: (Score:2)
Thank you, recursive merge sort project.
That's good and all but Bubble Sort FTW!
Re:the best. (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. :)
Re:the best. (Score:5, 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.
Re: (Score:3, Insightful)
Re: (Score:3, 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 st
Re: (Score:2)
"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 lan
Re:the best. (Score:5, Interesting)
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.
Re:the best. (Score:5, 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.
Re: (Score:2)
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 (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!
Re:Coders fault - Not the language (Score:5, 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
Re:the best. (Score:5, Insightful)
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: (Score:3, Insightful)
Objective, generic, functional -- its all there and accompained with the best preprocessor, macros and code generators
LOL
Re:the best. (Score:5, Interesting)
What really killed C++ for me was when a student created a situation like this:
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. (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.
Re: (Score:3, Informative)
Re:the best. (Score:4, Insightful)
Uh g++ catches that error for me. Though on the other hand, I consider -Wall -Werror to be basically non-optional arguments.
Re: (Score:2)
Re: (Score:3, 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. :)
Re:the best. (Score:4, 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.
Re:the best. (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.
Re: (Score:2)
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. (Score:4, Informative)
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.
Re:the best. (Score:5, 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.
Re: (Score:2)
% 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: (Score:2)
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. (Score:4, Insightful)
And if anyone thinks C++ is the perfect language they're an idiot.
Re:C++. lol. (Score:5, 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.
Re: (Score:2)
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: (Score:2)
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: (Score:2, Interesting)
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
read with a fake Scots accent (Score:5, 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".
Re: (Score:2)
Why would you want a fake Scots accent to do a ripoff of the Four Yorkshiremen sketch?
Re: (Score:2)
In my day, you got a fake Scots accent and you liked it.
C++ inside (Score:3, 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...
Freedom (Score:5, Interesting)
Re: (Score:2)
performance critical
Did you say "fast"?
Re: (Score:3, 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++.
C++ actually faster than C (Score:5, 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.
Re: (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 desig
Re: (Score:3, 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.
Happy Birthday (Score:3)
Yay, happy birthday, my favorite language :)
The "Right Problem" (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.
Re: (Score:2)
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... (Score:5, Interesting)
C++ FQA (frequently questioned answers) [yosefk.com]
(Defective C++ [yosefk.com] is a summary)
'There are only two things wrong with C++: The initial concept and the implementation' - and other quotes [cat-v.org]
Why C++ sucks [nothings.org]
And, previsibly: http://cplusplussucks.com/ [cplusplussucks.com]
Re:For some critical views of the language... (Score:5, Funny)
My favourite quote: c++; /* this makes c bigger but returns the old value */
Re: (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 ha
A tool for when you need to get the job done (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?
Re:A tool for when you need to get the job done (Score:5, Insightful)
Re: (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
Re: (Score:3, 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.
Re: (Score:2, Insightful)
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
Re: (Score:3, 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?
Re: (Score:3, Funny)
But keep in mind the joke "Eat shit! A trillion flies can't be wrong!"
Doom (Score:5, Informative)
Doom was written in C, not C++.
Written in C++? (Score:2)
Videogames like Doom, ...
Correct me if I am wrong, but I am pretty sure the first Doom was written in C [wikipedia.org].
"replacement language for C" (Score:3, Insightful)
trollface.jpg
Alan Kay said it best... (Score:3, 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.
Re: (Score:3, Funny)
Yeah. And then they added templates.
Another write-only language (Score:2)
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 behi
The Best Language Is The One You Know The Best (Score:2)
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. (Score:3, Interesting)
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.
What I want to know is... (Score:5, Funny)
Does Bjarne Stroustrop think of women as objects?
Re:What I want to know is... (Score:5, Funny)
Only if they don't have class ;)
Re: (Score:3, Funny)
Programming Machismo (Score:2, Insightful)
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: (Score:3, Interesting)
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.
I don't see how well-written C code
Re: (Score:3, Insightful)
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
C++ is the Beatles of Programming Languages (Score:2)
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 t
"Some surprising revelations" (Score:3, 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?
It's None of Those Things (Score:4, Insightful)
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.
The problem with C++ (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 [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.
Ada Programming (Score:3, Insightful)
Running with scissors and suckers on ice (Score:5, 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.
Brings back memories... (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.
The Real Headline (Score:3, Funny)
Bjarne Stroustrup Reflects On 25 Years of C++: My bad
Re: (Score:2)
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] ).
"Portable computer" (Score:2)
When was this written, 1978? "Portable computers" are called laptops or netbooks.
Re: (Score:2)
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: (Score:2)
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: (Score:2)
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?
Re: (Score:3, Funny)
Re: (Score:3, Insightful)
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 // blah
for (std::vector::const_iterator citer = myvector.begin(); citer != myvector.end(); ++citer)
{
switch (*citer) {
}
}
Semantically it's full of land mines. Co