Demise of C++?
fashla writes "Several somber and soul searching threads have been recently posted to the USENET newsgroup comp.lang.c++ such as "C++ is Dead" and "A Dying Era". The reason for this reflective mood is the sudden demise of the magazine C/C++ Users Journal (CUJ) http://www.cuj.com/ that had been published by CMP Media. Participating in the posts have been such C++ luminaries such as Bjarne Stroustrup and P.J. Plauger. While some contributers think that CUJ's demise is due to the general trend away from print, others think something else is afoot..."
Though it were hard for me to imagine, for instance, Unreal's engine being ported to Java, Quake seems to have fared well with feral C.
The problem with C++ is that it is neither as simple as C nor has it the benefits of Java and C# as they allow for code that is easier to read and understand. The available tools are also better for the competing environments on the upper side.
C is still developing features at a slow but steady pace and it has inherited a few from C++. There will probably be more features inherited in the future, which will cut more into the area of C++. The difference between C and C++ is that C isn't object-oriented while C++ supports object-oriented design. But object-oriented design is not necessarily needed at the low-level programming that is used when accessing devices and similar operations, and hence C will be the choice of such programming.
If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
If they want my C++ compiler they will have to pry it from my cold, dead hands!
It is by caffeine alone I set my mind in motion, It is by the beans of Java that thoughts acquire speed, The hands acqui
If you put it that way, everything is dying. I bet a buck that C# or Java will be dead as a rock in 20 years, just like C++ and most of the other programming languages we know today.
What we are noticing today is that programming languages alone just don't cut it anymore. The software is so advanced, that standard language constructs and libraries are way too raw to be applied to something useful for the average application programmer. Knowing frameworks, APIs and libraries is becoming a lot more important than using all the language paradigms and hidden tricks.
I think C++'s user base is splitting: On one hand there are the library and API developers, for whom the standard and the language are wholy. On the other hand, there are the application programmers, who care about the practical side of the language; they use it because it has advantages over other languages and has lots of libraries written for it.
My belief is that C++ is more alive today than ever. It is more powerful than ever. And it will be for a long time (in technology terms, indeed). Of course, in 10 years time it won't be recognizable. But it's wrong to say that C++ is dying.
We, C++ programmers, just got tired of being insulted all the time, so we don't talk much any more. After all, every time we mention C++ we are told how bad it is and how stupid we all are for using it. Sure, we can rebut all those arguments, but there are so many loud people declaiming them that nobody ever hears us. So, we just shrug, shut up, and go back to writing code. If you don't want to listen, you are only hurting yourselves and your employers.
Perhaps C++ has passed its apex, but programming languages do not die quickly. Fortran and Lisp are from, what, the 1950's? Cobol? Still with us. If it's in widespread use, it won't die quickly. I discuss this some in an article on the economics of programming languages:
a ge_economics.html
http://www.dedasys.com/articles/programming_langu
( although my hosting provider's network seems to be running a bit slow:-/ )
http://www.welton.it/davidw/
[rant] .. if ain't good by such and such a date then we cut it". So this cut has been in the pipeline for a while.
I don't know about any subversive anti C++ group that is plotting the downfall of this language, but I was taken aback last week when I received the next issue in my C/C++ Users Journal subscription that had a letter attached to it saying that it was the last issue ever. This pissed me off as you don't just dump a magazine like a hot potato, you track the way it is selling and you say "well
What also annoyed me about it was that the publishing company will transfer my exisiting subscription over to Dr Dobbs (though I can get my money back). Personally I feel that Dr Dobbs took a major nose dive years ago and is in no way of the same quality as the C/C++UJ. The transfer from glossy to newsprint style paper showed that they were needing to make cost cutbacks which implies to me that they were losing it in general. But what really took the cake was an article printed in the Dec 2005 issue where in a DB app, presentation was confused with storage in a manner befitting a failed CS101 assignement. While I gagged at the article itself, what shocked me even more was that the Dr Dobbs editors actually included it for publication. (As I blame the editors, I am not directly pointing to the article itself).
C/C++UJ said in their cover letter that they will be expanding Dr Dobbs to take on a lot of the content from the C/C++UJ. Personally I think that Dr Dobbs may be too far gone for this sort of recovery, and that I have lost a magazine that I liked, was to the point and generally full of quality (though other people may say I am blind about this). I may give Dr Dobbs the chance to show that it has improved, but I won't be holding my breath for very long.
[/rant]
I am Slashdot. Are you Slashdot as well?
Considering a recent internal project re-write, I can relate the following example.
The initial Java implementation had too large a system footprint (we required it to run on fairly low spec machines with limited resources).
The rewrite in C++ ran smaller, faster, and without the Java "slow to load and start" TM.
The trade-off for the re-write was the longer development cycle.
Overall, we don't see C++ dying, but as a great tool, which still has it's place.
Has Netcraft confirmed this?
Creationist Textbook Stickers Declared Unconstitutional by CowboyNeal
Despite my love for C++ I find myself writing less and less C++ code. Why? Well, I guess it's due Ruby ( http://www.ruby-lang.org/ ) in my case. And whenever I make an extention in Ruby I write it in C, not C++. Why should I spend 5 days writing a tool in C++ when I can write it in 5 hours using Ruby ?
I feel sad about not using C++ more often though, because it really was my favorite language for a long time. I just can't think of any project idea I have where C++ would be better suited than Ruby.
I don't want to be "Miss Pollyanna blue sky" but let's be honest with ourselves. Print will be dead in a decade. For all but the widest possible audiences (Time, Newsweek, People) magazines are useless in the digital age.
Ross Winn "not just another ugly face..."
C++ remains as the only proper object-oriented language. Despite all the years of continuous development in languages, there has yet arisen an overall better object-oriented language. Yes it's ugly. Yes it's cryptic. Yes, it explodes often. But there isn't another language that does things better. Take a look at its competitors: .NET. Stupidity for everyone!
Java - Oh wow, a language that inherited the syntax from C++. Also completely controlled by a useless business committee. Tack on the JVM and you have yourself a C++ killer! Oh wait...
C# - Like Java, but worse. Switch the Java committee for a Microsoft one. Switch JVM for
Objective-C - Is it used ever outside of Apple development?
Smalltalk - Nice and pretty. And unheard of outside of the niche.
Python, Ruby, etc. - Often considered too slow.
If anything, Java/C# are dying. The reason: Python, Ruby, and other interpreted languages. C/C++ blazes Java in speed, and the interpreted are much faster (and easier on the eys) in design. In fact, if everybody switches to Python (can't say about Ruby), C++ will continue to thrive due to Python's adherence to C/C++ module. Implement in Python; tweak in C/C++. Where would Java be?
C++ is kind of a monster of a language (almost as bad as Perl), but it is one of the few I'd choose for the niche where speed/space really count. Unfortunately for C++, there are very few programs for which this is the appropriate niche. Most of the C++ that crosses my desk should have been written in an appropriate scripting language (insert your favorite, Python's currently mine). I even heard a tale of someone writing a "makefile" in C++ (gawd). These mistakes cost a lot of time and money.
My biggest problem with C++ is the apparent lack of a decent conforming compiler (preferably with useful diagnostics). Every few years I check and it seems like they're nearly there...
"Not an actor, but he plays one on TV."
Just to add to this... Depending who you work for and what ill wind is blowing in your managers rear end, you could fine yourself defending your langauge of choice. I've heard "your using C that 70's yada yada", "we want java programmers they're easy to replace yada yada" and "Perl nobody uses that".
C where speed counts, and, for everything else, Java ...except that everyone has come to realize that Java is horrible. The language has some flaws but is decent. The big problem (I think) is java the platform. It's not designed to do things efficiently. I see a lot more growth (to my dismay) in .net languages than anything else and I see a steady shift away from java.
The thing we are shifting twords doesn't exist, but is being created slowly as we advance our programming languages. We need a nice platform that has a VM but allows you to write directly to machine code and have it interact gracefully with the VM based code. This way you could have your 3D engine coded hard and tight but your UI code could be up in VM land and loose and flexible. It should allow programming in multiple languages so programmers with all types of skilsets can program for it and allow the code written in different languages to interact. It should allow for scripting as well as compile to native OS executables for speed and to allow easy distribution. The best work I see twords that goal is Parrot (the new perl/everythning else platform). We'll see how that works out.
set softtabstop=4 shiftwidth=4 expandtab nocp worlddomination
Large parts of the Darwin kernel layer are written in it.
Anything Apple uses - *must* be a dead end.
Clear, Dark Skies
I've seen Jake2, the Java Port of Quake 2 to Java, but I've never heard of anything related to Unreal, or any port, related to Java. Can you provide a link to where you read that?
Anm
I wonder if C++ will remain the language for video games for a long time. It is one of those places where OO + efficiency are important. I believe there are engines written in C, but seldom entire games any more. Business systems care more about readability and scalability than efficiency, and languages like C#/Java offer a better balance there.
The grafting of OO extensions onto C was the worst design decision I have ever run into. The result is a crappy arcane and confusing kitchen sink of language to work in. However we do need a compiled, powerful OO language to work in. The opportunity is ripe for a replacement to C++, lighter weight, with GC support and a comprehensive set of libraries designed from the start to fix the problems with C++ without the need to maintain backward compatability with C++.
Call it what you will - the need is there and we have a large set of good ideas now on how OO should be implemented from Smalltalk, Java, Pythin, Ruby and C++.
C++ still is a lovely language, but it takes a very long time to program anything in it, because we do not program anything in it, unless it is worth taking a long time to program.
Flourescent (adj): smelling like ground wheat.
Saying that C++ is dead because C/C++ Users Journal is no more is about as ridiculous as saying that Linux is dead because Linuxworld magazine is dead. I'm sorry, but the two are not interconnected at all. True, there's no real magazine for C and C++ developers in the newsstands, but if magazine popularity has anything to do with it, then the same can be said for Perl, Python, Ruby, and a myriad of other languages that aren't in print. I'd be more inclined to say that the publishing industry for language content is dead as when it was time to renew my subscription to C/C++ UJ, I opted instead to not renew. Why pay $29.95 (or whatever the sliding scale that CMP Media uses to determine what you pay that month) for a bunch of articles that may or may not relate to doing useful work with C/C++ (and admit it... how many pure C++ articles were there? I remember many more articles on D, Java interoperability, and the like than there were C/C++ articles). I found that the one section I did read religiously was the fictional workplace created by Herb Sutter and his co-author (the name escapes me at the moment) which detailed three coders (the master, the apprentice, and the guru) against "Bob". That was about it.
:)
So, I don't think that C++ is going anywhere because the journal is going away... I think instead people who are using C++ will go elsewhere for information about C++.
No story here... move along.
IMHO, C/C++ is far from dying. It's getting stronger than ever atleast in the realm of software engineering. I see it finding it's nitch closer to the hardware and in core of advanced software where speed and optimization is important.
Like, you wouldn't write a 3D game engine in java, atleast not yet anyway.
Look at KDE what is it written in? and Unreal? What is the JVM itself written in? and
I still see that software engineers are still using it heavily where as the rest of us mortals in the business realm, develop in other interpreted languages that can offer faster development time. Cost is everything, we programmers are no longer seen as an asset but more as a cost. Java and Lamp programmers are just cheaper.
I find it very unfortunate that schools are no longer teaching C++ and switching to Java.
The end result is a more limited amount of advanced C++ programmers out there working on very important advanced applications.
"If a show of teeth is not enough, bite
...in that there's often more than one (or one dozen) ways to do something. I think a lot of scorn heaped on C++ is due to the fact that the scorner at some point opened up an STL file (or anything generated by Microsoft's ATL) and ran screaming. And frankly, they're right...that's some imposing syntax and not at all friendly to read or understand.
But what I've told people again and again is that *you* don't have to write it that way. Don't understand multiple inheritence? Fine...*don't use it*. Don't get templates? Fine...*don't use them*. We still use VC6 and its template functionality isn't even complete!
The truth is, you can have bizzare WTF moments in *any* language. A lot of what people attribute to the failure of a language is the failure of a programmer to properly explain what his/her code does in a straightforward way *using the code itself*. The best code is clean and concise and C++ gives you as much opportunity to do this as any language. Sure you can have multi-thousand line functions in C++, but this isn't a failure of the language to somehow magically break it apart for you into better organized bits, it's a failure to understand that a language, *any* language, whether purely written or even spoken, is to convey a message, a story, and without careful attention to detail, can become an unholy mess (like this post).
I agree with most of what you say except for garbage collection. Since I
do low level programming I want memory to be free'd when *I* request it,
not when the runtime (which would be extra overhead too) thinks it should
be done. The problem is C++ is trying to be all things to all men, as low
level as C and as high level as something such as python. Problem is what
you end up with is a rather unsatisfying smelly stew.
A horrid kludge that tries to turn C++ into a completely different
language. If I wanted a different language I'd use one. Plus it tends
to be a solution for problems that don't exist.
"would be nearly impossible to duplicate in C with the same kind of efficiency"
BS. Unless you think theres some sort of magical assembly language that
a C++ compiler can generate than a C compiled couldn't.
Among all the programming languages I've used over the last 25 years (6502/6809/m68k/... assembly, Prolog/Miranda/... functional, Perl/Tcl/Python/Lisp/Java/... interpreted, C/C++/PL-1/... compiled), only 2 really stand out as "excellent" tools:
C++ and Python. I really have to struggle picking which one I love to write programs in more. They both have their place, and they are both lovely in their own way.
As far as C++ goes, since it exposes all the "knobs and dials" of the underlying computing architecure, it does have a very long learning curve. However, Template Metaprogramming is unlike anything, available anywhere, in any other language.
Listening to all these Java/C# fanboys flame C++ templates, and compare them to "Generics" etc., is like listening to guys compare their cool Ox-Cart wheel mods, while saying how much that new-fan-dangled "ferr-ar-eee" Sucks...
Yes, it took *years* for me to master C++. Someone smarter, and/or with better (read: any) instruction would -- and should -- do better. But, being able to express an algorithm purely, which will compile efficiently to process *any* type(s), stored in *any* container, accross *any* architecture, with full static type checking and bare-metal hand-coded assembly language efficiency, is something truly unique in the programming language world today.
When some other language comes out with something better and more efficient than Template Metaprogramming, let me know. 'Til then, its C++, baby!
-- -pjk Perry Kundert perry@kundert.ca http://kundert.2y.net
NO TEXT
That's "Mr. Soulless Automaton" to you, Bub.
im with you buddy
C++ is still the main language i use, for its speed, power, and usability
... for a language that is just a hash of things created by random pounding on the keyboard.
You forgot the 5 minute wait as the garbage collector goes through full collection at that point. And it still may or may not be freed on the next line, as that uses another thread. And it still may or may not have finalize called. Etc.
I still have more fans than freaks. WTF is wrong with you people?
Long live c++!
"Times have not become more violent. They have just become more televised."
-Marilyn Manson
Actually, C++ isn't so bad until you start considering templates. Templates are what makes it such a blarggy language, and these days, it seem severyone is keen on showing how clever they are by abusing templates to the nth degree (template metaprogramming? Yeah, maybe for Letterman's "Stupid Compiler Tricks", but I'd probably fire someone who tried that in the real world). Of course there are too many useful things you can do with templates, now that they are actually standardized, but this only reflects flaws in the rest of the language and violate C++'s OO-ness.
So in that respect, C++ is like Perl, but if you are calm and rational, C++ can be elegent, reasonably efficient and maintainable.
There's a language out there, maybe "C*=3" that will solve the hideous of needing templates in C++ with the superior OO features of Java and C#, but still allows you to do all the good things you can do with C++ now, and doesn't give you the overhead of a VM or the next-to-worthless libraries that killed Java or the lock-in and overhead required by C-Pound.
I wish I could invent it.
You are in a maze of twisty little passages, all alike.
The real problem with C++ is not what all of the trolls spew out of their yaps. Its real problem is that it is a mid-level language.
.NET, are mid-level toolkits. Tk is the only high level toolkit I am aware of, but I respect my users too much to foist a Tk based application upon them.
The reason I haven't moved on to "higher" level languages like Python or Ruby, is the dearth of high level GUI toolkits. X11, Win32, etc, are low level toolkits. Qt, GTK,
My last project would have done well with Ruby, except for the lack of appropriate GUI toolkit.
p.s. Before you flame me to death, I am NOT a web developer. Ruby on Rails is NOT a solution for me. Anything involving client/server is NOT a solution for me.
A Government Is a Body of People, Usually Notably Ungoverned
...it was pronounced D flat.
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
While D certainly has some good points, I'm not entirely certain that even Walter Bright is certain it's entirely ready to take over as the premier language. Since you posted as AC I don't know if you read or participate on comp.lang.c++[.moderated] on a regular basis, but if you've been following all the threads, you'll notice where DbC is being discussed, and D is being used as a prime example of how to completely screw things up. Walter is participating in those threads, but so far he seems mostly interested in learning how things should work rather than claiming that D really has it right (for those who didn't realize it, Walter Bright was the inventor of D, as well as the author of the Datalight/Zortech/Symantech/Digital Mars C compilers for C, C++ and D).
Ah, it sounds like you probably do not follow the NG much, if at all -- if you did, I'm sure you'd realize that for people who already know programming reasonably well in some other language, Accelerated C++ is, far and away, the recommended book.
The reason for const parameters is simple: they restrict your access to the object so passed. Restricting access as much as possible at any given time prevents accidents, making for safer programs. '*anything' has roughly the same meaning it has in C -- you have a pointer(-like object) and '*' dereferences it. It's possible to overload the (unary version of the) * operator (or nearly any other operator) to do something entirely different, but it's generally poor style to do so. Operator overloading does give the programmer the power to do really bad things, and produce horribly obfuscated code, but it allows the programmer to do really good things, and produce much clearer code than is generally possible without it (e.g. overloading for matrices and complex numbers).
Specifically, it's converted by a constructor. That's exactly what the constructor is for, and it's apparently doing its job exactly as designed. Do you have some objection to things working as they're supposed to?
This is far from a pointless feature -- while most Java textbooks fail to mention it, this is one of Java's larger shortcomings. Making a function non-virtual says something specific about the design -- that the function in question is invariant across all descendants. The Java language simply fails to allow that concept to be expressed.
Declaring a method const also has a specific meaning -- that the method in question does not alter the logical state of the object. Again, this contributes to the safety of programming. It's true that many languages are utter failures in this regard, but this is an area of strength in C++, and rather a shortcoming in many alternatives.
Rather the opposite. GC and it's non-deterministic destruction (finalization) of objects prevents you from using RAII. The fundamental difference here is that RAII can be applied to nearly all kinds of resource management, where GC only applies to memory.
Back before RAII was well developed (or at least before I u
The universe is a figment of its own imagination.
First it was C++ World, now CUJ...DrDobbs can be really good, but at times I find it can really suck.
.NET magazines; or do we leave the C++ to the library implementors, and use another language without all the C++ bagage but with the wind in its sails (Eg C#).
Lets hope it can pick up some of the contributors we have all grown to appreciate over the years, Herb Sutter, Andrew Koening & wife, Lippman (who's doing MSDN mag), etc.
C++ has always taken what's good (STL), and dropped what wasn't (auto_ptr), and now more than ever developers using it will require assistance in understanding some of the latest developments in the language (Template MetaProgramming, concepts).
Sure the web is great, but a mag allowed for a monthly round-up in a easily accessible fashion, of all the language features (and darker corners).
We will have a C++09 standard, and for those of us using the language daily in creating apps that must sell, I believe there is a cross roads: Do we continue on using a very powerfull language, all the while having a harder time to find programmers knowledgeable enough to use it properly, having C++ magazines replaced with
I'll admit that a team of 6 C# devs may have an advantage over a team of 6C++ devs in the time to create software, to debug and test it, the available documentation, and the power of the language. Sure their code will run slower, but they rely on the Stan Lippman\s and Herb Sutter's @ microsoft to provide a good overall library...
http://superconfigure-supergroove.appspot.com/
After all, every time we mention [insert topic] we are told how bad it is and how stupid we all are for using it.
May Peace Prevail On Earth
I think the reason the CUJ has died is very simple: it wasn't very good any more.
A few years ago, there would be many useful things going on in the C++ world. Then there would be many useful articles to accompany them in the C++ and more general programming press.
Today, the C++ world seems to have degenerated into two camps: the naive group who still think it's great for everything and love playing with intricate templatey stuff just because they can, and the much larger, practical group, who continue to use it because as a pragmatic tool, it remains unrivalled for many programming jobs. Everyone else has long since jumped ship.
What the C++ press should have been doing is continuing to educate the programming population. One only has to read any programming language thread on Slashdot to see how many people still don't understand simple but very effective ideas like RAII, never mind the power of C++'s object/exception model in comparison to some of the alternatives. But today, most of the C++ press is just the same in-crowd of authors repeating the same tired mantras over and over again. And it's almost all negative: I'm surprised no-one's ever written "50,000 Ways Not To Blow The Whole Leg Off" or something.
As a practical tool, C++ remains one of the most useful and adaptable languages around. It's just a shame that almost none of the professional authors seems to want to talk about how to use it well. Maybe it's just easier to find yet another obscure way to break it, or yet another way to reproduce an example from chapter 1 of a functional programming textbook using only 150 lines of template code. Until your magazine fails because no-one cares anymore, anyway.
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
I think you've hit the problem with today's programming world right there. The STL -- or rather, the part of the C++ standard library that comes from Stepanov's original ideas -- actually isn't very good.
Don't get me wrong, it was a very interesting concept, and has some great ideas. It's just that the potential was never realised in practice within the C++ framework. The containers and iterators relationship is a decent start, but the toolbox isn't full yet: the support is poor for concepts like ranges (and maps between ranges from different containers), sources and sinks (or "generators" or whatever we're calling open-ended ranges this week), indexing... And of course, the algorithms would be great if C++ had good support for closures/lambda expressions/whatever, but as it stands it's often better to write a simple loop than to use one of the standard algorithms.
In fact, the STL suffers from much the same core problem as C++ itself: it had a lot of potential and introduced new ideas in its day, but with the benefit of hindsight that we now have, the design seems clunky, the quality is patchy, and we could do a lot better by starting over and learning from what worked and what didn't last time. I'm just waiting for someone to do that; it seems to me that there's an obvious and enormous market waiting for the natural heir to C++ (which doesn't look much like Java, C# or D, IMNSHO).
When that successor (or possibly several successors with some common advantages but different foci) does arrive, then we'll have your crossroads, and C++ and the STL can be retired to a well-earned place in programming history. Until then, they're the best we've got for a lot of jobs, but that still doesn't make them good on an absolute scale.
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
I subscribed to CUJ for some time, and I can say that I can get 3/4 of the same information from a single good C++ reference book as I can in every issue I got in the 2 1/2 years I subscribed. The reference, however, is much more efficient.
I find it interesting that C++ is supposed to be dying with all those developers using it. The top 3 programming languages on SourceForge (based on number of projects using it): 1. Java (17457 projects) 2. C++ (17281 projects) 3. C (16363 projects) I think this indicates that C++ is quite healthy... I'll definitely stick to for yet a while.
You forgot the 5 minute wait as the garbage collector goes through full collection at that point.
If GC takes that long, something is wrong.
As you likely prefer malloc/free over GC I like to ask one question: how long did you learn to use malloc / free? Did you only read 1 minute to find the two functions and you imediatly used it perfectly, or was there a learing curve?
And it still may or may not be freed on the next line, as that uses another thread. And it still may or may not have finalize called. Etc.
If the GC collects your object, finalize *is* is called. You likely don't know much about Javas and
So, after you probably thought about my question: why don't you spend a similar amount of time in learning how GC works? Most posts on
angel'o'sphere
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
Perhaps you mean C++0x?
Making a function non-virtual says something specific about the design -- that the function in question is invariant across all descendants. The Java language simply fails to allow that concept to be expressed.
Totally incorrect. In Java, you would use final methods.
Eg, protected final void blah(). The fact that you can do exactly this is responsible for the Java textbook "conspiracy" you've so boldly cast the light of public inquiry upon.
I'm taking a wild guess, but you've probably never done in anything Java beyond superficial "Hello, world" apps, have you?
If you think Templates are bad, just don't even look at programming using Reflection in Java like languages.
C++ seems to be a language where you just work in it, and have the ability to do fancy stuff too. I think that's a strength, don't let other people's idioic coding practices (the "look how clever I am" coders) tell you otherwise.
C++ is the only remaining major language which has hiding without safety. C has neither. Java, C#, the Pascal/Modula/Ada/Eiffel family, and all the scripting languages have both hiding and safety. That lack of safety is responsible for most of the crashes and exploits in today's software. When a virus takes over your machine due to a buffer overflow, it's probably because of that bad design decision in C++. Every day, hundreds of millions of people must suffer because of that mistake.
The largest single problem comes from the decision in C to treat a pointer and an array as the same thing. This seemed convenient thirty years ago, but created a language in which the size of an array is not permanently associated with the array. In particular, the fact that arrays are passed to functions without size information is a huge source of trouble. This, of course, is why we have buffer overflows.
Attempts were made in the STL to fix this problem, but it didn't really work out. Trying to retrofit strings to the language via the template mechanism was not all that successful, since so many libraries and system calls required the old-style strings.
Safety is not a performance issue. It's possible to do checking very efficiently, if the compiler knows what to check. Subscript checks can usually be hoisted out of inner loops at compile time. But this is not possible for C++, because the subscript checking, when enabled, is in the STL, not the language.
The second big problem in C++ is the need to obsess on "who owns what". Memory allocation is the nightmare of C++. Again, the STL tried to address this, and again, it was botched. The auto_ptr debacle illustrates the limitations of the language. There have been many, many attempts to implement "smart pointers", and they're all unsafe. At some point, you have to extract a C-type pointer to get something done, which introduces a hole in reference counting. If you don't extract raw pointers, you spend too much time updating reference counts. Again, this is something that a compiler could optimize if the compiler knew more about what was going on. But with reference counting implemented at the macro level of templates, that's not possible.
Garbage collection is occasionally proposed as a panacea, but it's not compatible with the concept of destructors. In a garbage collected language, what destructors and finalizers do must be severely limited. This is contrary to the C++ concept of "resource allocation as initialization". You don't want to close a window from the garbage collector. Also, introducing garbage collection introduces a form of concurrency, in a language that doesn't handle concurrency well. There are workarounds for this, but like most workarounds, they're painful. Take a good look at how Microsoft's "Managed C++" approached the problem. It's wierd; read about "resurrection, where an object comes back to life during garbage collection.
Those are the two elephants in the living room of C++. Denying them will not make them go away. This is harsh. But it's not wrong.
I saw this back in the late 80's/early 90's, when 4GLs were going to replace everything esp. languages such as C (2/2.5 GL language). They all disappeared. All the pundits against C are LONG gone.
C++ will be around for a long time due to one reason; safer than C and close in speed to C. It is a very good lanaguage for doing apps with. The problem is that somebody is trying to use a mag. writers and subscribers as a way to judge a language. That is one of the silliest ways to judge what the future holds for C++. Now, if you are trying to judge the mag, well, I left it long ago. It was way to expensive for what we were getting. In addition, I do not want print. I want it on a PDF on a CD (or better over the network). But they are not changing. Judging the language by subscribers is a bit like RIAA judging the CD theft by the fall of their products (which is more related to lousy products).
I prefer the "u" in honour as it seems to be missing these days.
That should be 'C'.
You're absolutely right, and after 13 years of C++, that's exactly what I do. Actually I'm doing mostly Tcl work now with some C, it's my first non-Windows job since 1990 and my first non-C++ work since '93. It's an interesting change. Tcl is a neat language although its capabilities for handling data structures leave a lot to be desired.
I'm convinced, as I said elsewhere, in this thread, that there is the perfect language hiding (mostly) inside C++ struggling to get out. Of course, the prospects of what will actually come out from C++0x actually scare me, but that's because I find things like STL obfuscating and wholly contrary to OOP and I think, in part, they are running the language off the rails by focussing attention on its more hideous bits. But it could be worse, they could be adopting MS's "managed" C++ with all their non-standard extensions.
Of course, at the end of the day, the language almost doesn't matter. It's the libraries that come with the language that make all the difference in productivity, which I see has been recognized by the C++0x folks as a very important aspect of the new standard. This is, in my opinion, why Java sucks for UI. It might be platform-independent, but it looks bad and works clumsily on all platforms. I found it wholly unusable as a solution for developing meaningful and non-hideous GUI's back in 2000 when asked to investigate. Although it seems better now based on some Java apps I actually use, some people who claim to know better argue that it really isn't.
As a long-time Windows developer, I always thought MFC was a good first cut and once it was fleshed out a little more and the developer was hidden 80% of the underlying Windows minutia (as opposed to 20% or so) that it could be really great. It begain to utilize the great power of C++, but because of horrible trade-offs made in the Windows 3.1 on 10MHz 286 days, there were so many legacy malfeatures that would never go away. Little did I realize that in the 10 years I used it that no significant improvements would ever be made, as MS focussed on other (equally underdeveloped) tools instead.
A good class library should make easy things clean and simple and hard things clean and simple. MS libraries, in particular has always made easy things messy, and hard things sometimes so much trouble that rewriting functionality from scratch is often a viable alternative. And in MS terms "easy things" is so narrowly defined as to be almost useless. It's like a car that is supposedly easy to maintain, but you have to remove the engine to upgrade the tires, and you have to upgrade the tires before you can use the Reverse gear.
Oh well.
You are in a maze of twisty little passages, all alike.
talking about them being dead and that was one of the better moves
I've made in the stock market... I imagine all the Sun people are
really concerned too; they're as good as dead. I suspect redbull is
killing coke too, they are probably dead.
I like C++, I like the idea and the intent. After spending like 10
years going through standards processes, I actually like the end
product and the STL and what have you, it's substantially more clean
that it was in 1991. I think they got a good 80% of the way there.
There is still some jankiness though.
I think the thing with C++ that is larger is that they are still old
world. There is no quick movement and there still isn't any "21st
century" development style in the standards group. Java has warts but
one of the great things it has going for it is Sun produced a lot of
standards and then the jakarta group did the same and there tends to
be a lot of similarity between "high quality" java products and
components. There is a ton of java stuff to reuse and the code tends
to be be laid out in a similar way, built in a similar way, javadoc is
used, xdocklet is used, etc.. C++ doesn't have any of these standards
working for it and there aren't any major projects (maybe KDE and QT)
that are really sort of laying out the guidelines and building
reusable components. In short, nobody is really showing everyone else
"how to do it." I think that alone has accellerated java at a
remarkable rate.
Beacuse of all of that, I don't know of a lot of good high quality
C++ reuse. There are some knickknacks that might be reused. Then
there is kind of this whole-world style framework, like QT which
includes tons and tons of stuff. Simple little libraries don't seem
to be popular because there are so many different ways you can use
them, different conventions, etc.. Every time you start a C++
project, you're starting over from scratch. The other thing java has
helping it is the class library. You cna buy Roguewave or something
but there isn't a good opensource alternative. Boost is kind of
filling the gap but it's still a little project and I think the scope
has stayed fairly small for a lot of reasons, many of which are
political.
Part of this is the C legacy and the C++ attitude, it let's you do
things "your way." And the languages tries not to do "too much" yet
it's supposed to compete with higher level languages that are totally
tricked out with features and libraries. I think if you were
starting a new large scale application project and Java wasn't an
option and mono/.net wasn't an option and you were looking at C++,
GNAT would also have to be considered (as radical a thought as that
is) because I think there might be as much or more high quality
reusable componets that you could harvest for it.
It just needs a really strong leader and some community built up
around it. Define some common framework rules. Write a couple
frameworks, if I could just instantiate a socket class (with SSL as a
yes/no flag) and create a high performance and high quality C++ server
network server in a small chunk of code, in a standard like way,
that'd be cool. Imagine that it had some template based policy stuff
that allowed me to plugin validators and crap like that and we created
a nice reusable network component and started to make some of the
security holes in that stuff go away... Simple and clean, reusable.
WOuld you write your own server everytime now or would you use this
one?
I wouldn't worry too much, there's always bad stuff and poorly implemrnted stuff in everything. The only thing I'd say to you though, is get famuiliar with the STL. Even if its just the container classes. They're possibly the best thing about C++, they're fantastic. Once you've grasped them (and its really easy to understand once you look) you'll never stop using them.
cheers.
I think templates are a beautiful feature that was accidentally far more powerful than the creator ever intended. OTOH, I think many of the details of how they work are horribly ugly, and that their interactions with other parts of C++ leave something to be desired.
I would like to see a language that made the concept of templates its center. The meta-language (the template language) would be a pure functional language. The language would be an imperative OO language without mandatory garbage collection that allowed the creation of objects who's storage could reside on the stack, the heap, or inside other objects.
Need a Python, C++, Unix, Linux develop
Interesting but could this just be a sympton of this article. I am certain that the demise of the magazine will not bring about the end of the language it, like C, has a very special place in the hearts of programmers.
BOO
I guess I'll be cleaning out my office then.
OSGGFG - Open Source Gamers Guide to Free Games
Whats the replacement? Java?? C#?? Thats like saying SQL is dying. Perhaps people are perceiving that C++ is dying simply because of the incredibly over hyped "web-centric" world of the programming in the new millenia. Languages like PHP and ASP.Net and Javascript (all web languages) have taken the forefront because business these days are demanding more web (scripting) applications. But that doesn't mean C++ is dying by any means.
In fact a lot of your network servers, programming IDEs and language interpreters are written in C++. It's true that C++ jobs are decreasing a little but again that is only because C++ is becoming more of a specialized language as it should be. A lot of apps do not require the complexity of C++ when a language like C# will do the job. But there are limits to what C# and Java can do. The only other language, I could think of that could have possibly taken C++'s place back in the 80's was Pascal or Object Pascal (aka Delphi), but never did. Besides libraries like the STL make C++ even more powerful and easier in many cases.
Comment removed based on user account deletion