Stroustrup on the Future of C++
/ASCII writes "Bjarne Stroustrup, the father of C++, has written an essay [PDF] on the features of the upcoming C++0x standard. In his essay, he argues that new features should whenever possible go into the standard library and not into the language, but that the language needs to shave of a few rough corners to make it easier to use for novices."
It is interesting to see how an abstract language like a programming language evolves through time. I would think that in a language like C++ the more userfriendlyness should be in the libraries and not in the language, so I agree with the author on this point. Putting it in the libraries makes it better backwards compatible, and distributable.
My wife's sketchblog Blob[p]: Gastrono-me
Shaving off a 'few' rough edges to make it more easy for newbies... It's that what Sun tried to do? (hint: java)
Wenn ist das Nunstueck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.
.. as to the pronunciation of 'C++0x'. Any suggestions ?
Stuff that went into Boost should be in the standard library from now on... Also anyone who has had to use g++filt will agree with me that C++ STL error messages need to look less like the dog's breakfast :)
Quidquid latine dictum sit, altum videtur
but that the language needs to shave of a few rough corners to make it easier to use for novices. - that is probably true. Analogy:
GLICK
Exactly! And that's what we're looking to do -
shake these people up a bit, get them motivated.
That's the whole point of the campaign. Mass
attendance is at an all-time low in this country.
And it's not like we're losing them to the
Protestants or Baptists - people aren't practicing
at any denomination these days. If we can sell
them some show - let 'em know the Catholic church
has some panache, we can win them back - even get
some new ones. Fill them pews, people - that's the
key. And cross-promoting - like with the cereal
tie-in grabs the little ones as well. Hook 'em
while they're young.
(sits at his desk, lights smoke)
RUFUS
Kind of like the tobacco industry?
GLICK
Oh - if only we had their numbers. But we are
aiming for the same demographic, even though mine
is the soul-saving biz. And if I have to play a
bit of the devil to bring them closer to the Lord,
then I'll wear the cloven hooves and carry the
pitch fork.
-
Today the battle is between Java and C++ and Java wins. Not because it's faster, because it is more convenient.
What C++ could use from Java? Why, an option to have garbage collection for starters. Just an option, not a requirement.
You can't handle the truth.
Am I the only one who wonders why we need a successor to C or C++?
I've sat through the past 10 years and watched things like Java and D and Objective C come, but meanwhile most serious OS level and game development continues to be in C or C++. Doesn't this demonstrate that new language are merely a distraction to developers who haven't fully exploited the current set?
Perfect opportunity to come up with a decent name but nope, geekiness prevails and the best he can do is: C++0x
But how about a language that doesn't require me to change zillion source files whenever I switch compiler or development environment?
And I hate PDFs...if it had spiffy charts or images or something, it would be great...but it's just text! Opened it, saved as HTML and it was 78k.
Shutting down free speech with violence isn't fighting fascism. It IS fascism!
... its embarasing. Compare it to CPAN (perl) or Java. It can't do very much. I wish they could get some real functionality in there. Adding the Boost stuff is nice but. What some something like Java's SWT where you can write an entire GUI using the standard library. Now that would be an improvement for C++.
.h header files. Call it the standard and let vendors code it out. Sweet!
I would be very easy to do. Just "steal" the API spec's from Java. That's what C# did. Just recode the entire Java API into some C++
Why do we need this? D is a beautiful, well-appointed systems programming language. It's got a gcc front-end. It's got garbage-collection if you want, custom memory management if you want. It's got embedded assembly if you want. And it's fast
I thought we were staying with C++ because of all the code that's already written in it...
Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
C was never a "nice" langauge, it was ugly, had massive problems around memory allocations, and the old unallocated pointer problems. It had unmangled names, so everything was in a global scope.
Then you had langauges like Smalltalk and Eiffel, elegant languages, simplicity, languages which gave control and power.
Then came C++, like C but improving on some things (name mangling), and adding the "power" of multiple inheritence. But worst it didn't solve the problems around memory allocation.
Languages like C# and Java have learnt from C++ and made it much easier to use (but not from Smalltalk see Ruby for evidence of that, and not Eiffel damn though it was good to develop it).
C++ was IMO a dreadful halfway house of a language that had most of the flaws of C and none of the advantages of Smalltalk/Eiffel.
Sometimes the best thing a creator of a language could do is declare it "dead" and get people to move away. Why do C++ if you can do Java/C#, why do Perl if you can do Ruby?
An Eye for an Eye will make the whole world blind - Gandhi
So, instead of "Array of pointers pointing to array of pointers", can I just write "Gimme those goddamn arrays"?
I still remember the 'C++ Advisor' or something the like from Unix Magazine or a similar publication who wrote his last column giving up on the language because only a language lawyer could keep up on the accretions to it. I don't remember what the guy went for, but if one is into OO C derivatives you have C# with its integrated, extensible type system from the DBMS up to other languages. Or Java, if you don't want to be torpedoed by MS' 'IP'. C++ should have been fixed a long time ago, but then AT&T wouldn't have suffered from NIHS and we'd be all using ObjC and OpenStep.
Leandro Guimarães Faria Corcete DUTRA
DA, DBA, SysAdmin, Data Modeller
GNU Project, Debian GNU/Lin
This is cool, but is c++ already dying? Do people in school still learn c++? I just graduated with a CS degree and the last two years all I used in my classes were java, and now that I'm at work all I use is c#. I know most game programming is still done in c++, but if the universities have moved on, the industry won't be far behind.
I really wonder how they're gonna do that. I know some compilers have tried that in the past, with some export template thingy stuff. Templates where instantiated at link time. However, AFAIK, that never really worked.
Tristan
Every time a cost of entry is reduced and the expected prerequisites are thrown aside, the result is a truly less capable *person*, not a more capable tool.
Agreed - There are some things that need smoothing, but I for one am tired of dealing with people who lack a fundamental understanding of the *systems* as a whole. Examples of this are the folks coming out with CS degrees who aren't even capable of following a thought, let alone starting an actual career designing and developing software.
For them, a tool like Java offers an entry level that is acceptable given there current capabilities - A tool geared towards THAT user (and a fine one at that).
But C (and C++) can be leveraged by people who know the tool and *use* the tool for what it can do, even with it's high(er, intellectually) cost of entry.
2020. Good luck getting all the stuff in. Long live open standards.
... posts the AC as he thinks to himself, "VB roolz".
twitter.com/gravitronic
is its brittle in-memory object layout. Add a new virtual method to a class and - kaboom - all third party libraries no longer work with that class. And please spare me the "you should design it better" crap. C++ could learn a lesson or two from CIL or the Java class file layout. The standard C++ ABI adpated from the Itanium is a step in the right direction - but it is too small a step. A complete overhaul of the object layout is required to foster development of C++ third party libraries. Imagine Java libraries with the same brittle object layout that C++ currently employs. It would never have gotten off the ground.
I program in C++ from dawn to dusk, and a few things really irk me about it:
1. Member function pointers. Implementation dependent and messy syntax that few people even know about. Their use is limited, and they don't support delegates like C#, making them ugly to work with.
2. The "virtual =0" syntax instead of something nice like "abstract" or "interface" is just weird. How can you set a prototype equal to 0? What's wrong with nice words?
3. Operator new and delete were designed by someone on crack. The only way to call a constructor is with placement new, whose syntax looks like: new (var) type(). Placement delete, however, doesn't call the destructor, which must be invoked manually. Furthermore, delete can't take parameters like new. What.
4. There is a "typeid" operator but no "typeof" operator. GCC has an extension for this, but it's not standard C++ I think.
I'm sure there are other language constructs that have annoyed me, and if you don't read my mind and fix them, Bjarne, I will kick you in the pants!
If you say "here goes my karma" I will bite you!!!
I don't recall who said "C++ is to C as cancer is to lung" but never have truer words been spoken.
In no way. If you read the B.S. writings (and I recommend he favor the world with a middle initial) he is always concerned with teachability of a feature, which is pretty understandable when you consider he's an academic.
Now, what an academic is doing having a successful programming language with real-world applications is another question...
Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
I don't understand why languages that take someone like me hours and minutes to learn fully have to be changed will-nilly every ten to twenty years. It's invariably the same, I'm just getting used to churning out my code in the latest fashionable language when a new one comes along, and I have to change over or no-one will talk to me on irc, and I won't get any chicks.
Don't they realise they are hurting people with their constant, pointless tide of fashions? What's next? C+++++super : The Next Generation. Why not spend time doing one superlanguage and cut out the bullshit once and for all?
the language needs to shave of a few rough corners
Yo nee t b carefu whe cuttin corner; i yo cu to fa yo ca reall "f" yoursel ove goo!
--MarkusQ
And I thought C++ was a bastard child.
Nice to know someone's stepping forward to claim responsibility.
I read the article and was confused by some of the code examples.
The '=' have been replaced by '-' signs. (In Acrobat 7 on Windows anyway.) The code makes a heck of a lot more sense once you realize this.
I'm a first year programming student at an Ivy League school and I've
just finished my Visual Basic classes. This term I'll be moving onto
C++. However I've noticed some issues with C++ that I'd like to
discuss with the rest of the programming community. Please do not
think of me as being technically ignorant. In addition to VB, I am
very skilled at HTML programming, one of the most challenging
languages out there!
C++ is based on a concept known as Object Oriented Programming. In
this style of programming (also known as OOPS in the coding community)
a programmer builds "objects" or "glasses" out of his code, and then
manipulates these "glasses". Since I'm assuming that you, dear reader,
are as skilled at programming as I am, I'll skip further explanation
of these "glasses".
Please allow me to make a brief aside here and discuss the origins C++
for a moment. My research shows that this language is one of the
oldest languages in existence, pre-dating even assembly! It was
created in the early 70s when AT&T began looking for a new language to
write BSD, its Unix Operation System (later on, other companies would
"borrow" the BSD source code to build both Solaris and Linux!)
Interestingly, the name C++ is a pun by the creator of the language.
When the first beta was released, it was remarked that the language
would be graded as a C+, because of how hideously complex and unwieldy
it was. The extra plus was tacked on during a later release when some
of these issues were fixed. The language would still be graded a C,
but it was the highest C possible! Truly a clever name for this
language.
Back to the topic on hand, I feel that C++ - despite its flaws - has
been a very valuable tool to the world of computers. Unfortunately
it's starting to show its age, and I feel that it should be
retired, as COBOL, ADA and Smalltalk seem to have been. Recently I've
become acquainted with another language that's quite recently been
developed. Its one that promises to greatly simplify programming. This
new language is called C.
Although syntactically borrowing a great deal from its predecessor
C++, C greatly simplifies things (thus its name, which hints at its
simpler nature by striping off the clunky double-pluses.) Its biggest
strength is that it abandons an OOPS-style of programming. No more
awkward "objects" or "glasses". Instead C uses what are called
structs. Vaguely similar to a C++ "glass", a struct does away with
anachronisms like inheritance, namespaces and the whole
private/public/protected/friend access issues of its variables and
routines. By freeing the programmer from the requirement to juggle all
these issues, the coder can focus on implementing his algorithm and
rapidly developing his application.
While C lacks the speed and robustness of C++, I think these are petty
issues. Given the speed of modern computers, the relative sluggishness
of C shouldn't be an issue. Robustness and stability will occur as C
becomes more pervasive amongst the programming community and it
becomes more fine-tuned. Eventually C should have stability rivaling
that of C++.
I'm hoping to see C adopted as the de facto standard of programming.
Based on what I've learned of this language, the future seems very
bright indeed for C! Eventually, many years from now, perhaps we'll
even see an operating system coded in this language.
Thank you for your time. Your feedback is greatly appreciated.
...change the name from C++ to Coo
if that were to happen i'd *so* be exhilerated!
not having a way to initialize a std::vector with some values has always been one minor annoyance for me when using the stl containers!
and about that "expert" thing: it is not by chance that c++ has become an expert-oriented language! there are SO many hidden traps and arcane details to get wrong that one can't just use c++ with intermediate skills and hope not to be punished! even the most simple mistakes can (and will) lead to segmentation faults and memory corruption!
i am not even saying that c++ is an evil language, but it sure as hell isn't newbie-friendly!
http://linux.wku.edu/~lamonml/software/cpptruth.ht ml
So what is C++0x going to obfuscate now ?
*ducks*
\u262D = \u5350
BTW Some people don't see memory allocation as a 'problem'. For many applications you want complete control over memory allocation and you don't want garbage collections and random moments, expecially for applications with a real-time component.
What I don't understand is this: if you're going to sacrifice performance then the world is your oyster. Why do you have to use some lame C++ clone like Java or C#? Why not try ocaml (whose performance isn't bad at all anyway), or Haskell (where you can make your code as elegant as a Haiku), or some other powerful language. C# and Java solve only one problem in C++ but otherwise open up few new options. Functional programming languages rethink the entirety of programming and make countless new techniques available.
Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
I'm pretty sure C++0x would be pronounced "Cough?"
Give me a break. Java was the successor to C++, and C# is the successor to Java. C++ is only useful now for maintaining legacy apps. You'd have to be out of your mind or without other choices to choose to start a new codebase in C++, or Cooties or whatever the new one will be.
I miss that keyword very much. And after my public discussion with GCC gurus, I know it won't be implemented in gcc neither :-(
template serialize(const T& t);
that prints the members of the class recursively.
Wondering why i am doing so strange posts? I am trying to get a "+5,Flamebait" or "-1,Insightful" rating.
...we wait for people to actually understand amd implement the current C++ standard?
Recall that C++ remains the one big monstrosity of programming languages, with the standard being around 650 pages (cf. Modula-3, which has about 50, or Standard ML, which even gives a full operational semantics in 100 pages). If we ignore the obvious question of why anyone in a sane state of mind would even consider using such a design-by-committee feature-bloated behemoth (kudos to Stroustrup for actually recognising this now), the issue remains that compiler developers will have a very hard time keeping up with this beast if it keeps jumping around like that.
"template typedef" is for instance something very important (and that will very like be added). Templates are a compile-time functional language, and i think that making this functional language more powerful and easer to use could be a big win.
Wondering why i am doing so strange posts? I am trying to get a "+5,Flamebait" or "-1,Insightful" rating.
I won't argue the relative merits of C++ to other languages. For many organizations, switching from C++ (regardless of whether it would make things easier) is often not an option, and not considered as an option. I will also not argue whether that is bad.
... For Great Code!
The fact is, there's a huge C++ user and code base out there, and if they are going to stick with C++, there's exciting stuff coming.
I feel that C++ is having its second coming, primarily due to developments like the boost library and the Modern C++ Design book.
For example, I've been using a combination of boost::function and boost::bind to make powerful, flexible callbacks like nobody's business. Finally, there's a function "pointer" that can work with both freestanding functions, member functions and function objects, and finally there's an easy way to delay calling functions and use closures, respectively. (Also see boost::lambda).
Sure, almost all of this has been possible one way or the other (the flexible callback has been typically implemented via function ptr and void ptr argument, C-style), but it's very refreshing to actually have the code say what you mean: "I want to delay calling this function", or "this callback doesn't give a crap whether the function you're giving it is a member function or not".
Then there are smart pointers, which have easier-to-follow, clearer semantics, and can be used in STL containers and such. No more using easy-to-shoot-yourself-in-foot auto_ptr. It's been possible to write large chunks of code that have multiple "new" statements, but have no "delete" statements, all while maintaining exact control over the memory allocation.
Of course there's more... Maybe it's stuff that LISP/Scheme programmers have been using for ages, but the key difference is I can now apply tools in production commercial C++ code, during my everyday work. I no longer sit and say: "oh, crap, I could really use a closure here." I just do it.
A big problem is that the new features require greater understanding of the language and thus better training of the run-of-the-mill C++ developer. Many C++ developers I encounter do not have the sufficient understanding of these tools, and of the language. We should strive to educate our fellow developers,
....using "C" derived languages?
Haven't we suffered enough?
I've used either "C" or C++ primary language for over 20 years now (C++ for 16) with Pascal and Ada in the background.
In spite of all C's fault, C++, I could understand as a reasonable transition from C to OO. For the life of me I can understand the twisted logic that brought Java and C#.
Ada and Pascal are much easier and much less error prone than C/C++. That is not to say either is the ultimate solution. Ada is overkill and inept in its OO implementation. [Object] Pascal has some compromises that place some unnecessary limitation. I would kill for something like Ada threads (tasks) in a languages.
I just can't understand why we aren't moving in that direction?
C++ is a general purpose standard programming language that scales up or down. The same is not true of either C# (Windows programming language) or java (not standard, requires substantial runtime support)
What would be great if C++ gets member function pointers to make things like:
:-)
button.onClick = myObject.handleClick;
(Delphi has this sort of event handling)
At the moment you have to play with ugly templates (see gtkmm/sigc++) or you have to make language extensions like Qt does with Signal/Slots.
If C++ would have easy member function pointers (without scary syntax) it would be possible to make nice GUI toolkits in it. The Qt-way is good but not standard... MFCs and wxWidgets way of event handling are ugly C macro dispatch tables, afaik...
Easy member function pointers -> please put it in!
- Some cases where you can type ; where previously {} was necessary, saving as many as two keystrokes.
- The lexer ambiguity where a<b<c>> and a<b<c> > meant entirely different things is fixed, saving as many as one keystroke.
- EVEN MORE "free" constructors which may or may not work quite the way you wanted them to in practice.
- More "fancy cast" operators, which sounds nice until you remember that if there's ever a time you find yourself using the C++ "fancy cast" operators, then there is a damn good chance that it's because you're doing something unwise enough it really would be a better idea to refactor the code to make the "fancy cast" unnecessary.
...in the meantime the fundamental issues with C++ remain not only unresolved, but unaddressed. The template system is still not a generics system, but an ugly cut & paste macro system which can incidentally be used for generics, with some caveats. The class system is still fundamentally brittle and unfriendly to simple things such as upgrading a DLL or determining at runtime if two objects are of the same type. The syntax is still a forest of features whose features interact in ways so crazy and unpredictable it approaches Perl in its chaos; references are still gimped; the distinctions in behavior and use between static and dynamic objects remain awkward and newbie-unfriendly. The features that people obviously desire to have in the language as demonstrated by their tendency to hack them in with third-party libraries (like BOOST) are-- they tell us-- a good thing, and they tell us we should continue to hack them in with libraries (like BOOST). That's nice. You know, that would be a lot easier though if we had a macro system** capable of anything smarter than blind code cut and paste-- or at least a macro system** fundamentally designed to be used for anything at all other than generics.Meanwhile, it appears if I'm reading this right that the most important differences in C++0x will be changes to the standard library. Great. The STL was defined how many years ago, and it's only just in the last few years that compliant implementations have become commonplace? How many decades will it be before the "C++0x" library changes have become common in a cross-platform compatible way?
C++ is an extremely useful language, and making an update to C++ which changes as little as possible so as to follow some kind of "if it aint broken don't fix it" principle is an idea which makes a whole lot of sense. However it seems likely to me from reading this that C++0x will offer so little significant difference from C++ as to make itself simply redundant.
* ("C++0x". Were they specifically trying to come up with a name less convenient than "C#"? Ah well, I guess we can call it "COX" or "cocks" for short.)
** "Template system"
Irritable, left-wing and possibly humorous bumper stickers and t-shirts
More powerful languages like ML, CAML and some Schemes have a module system. This allows the programmer to control the meaning of identifiers (e.g. what function they mean). E.g. what gets imported (and with what name), what gets exported.
Often there is a separate notation for the modules -- it says what files contain the things, what's exported/imported etc.
That's very useful for encapsulation.
C++'s namespaces are a crappy attempt to get the benefits of a module system -- that's likely where he got the idea from.
Hygienic macros would be a good step too.
http://www.thebricktestament.com/the_law/when_to_
Just use perl. Seriously. You'll be way more productive and you'll come up with better OO designs.
And if it's performance you're worried about, well okay. Code the performance critical parts of your application in C (not C++) and do the rest in perl.
C++ is losing market share in terms of new code being deveoped.
The advance of Java and C# prove that large parts of OO functionality found C++ are not necessary.
C++ should come in two standards:
- C++ lite - essentially what C# is today
- C++ full - essentially what C++ is today
--
What short sigs we have -
One hundred and twenty chars!
Too short for haiku.
... aren't that standard. Look at the effort that it takes to get Java ported to somewhere. Kaffe is/has been ready for years. Classpath (your standard library) is only getting useful (it compiles Eclipse!) And how many "deprecated" components are there in Java? C++ has plenty of people working on less-than-set-in-stone projects, but those shouldn't be considered standard. Use gktmm by all means. Use Qt. Use ACE. None of them can be considered standard, but you can use them today and Get Shit Done (TM). Hell, even Boost isn't standard. The day anything turns standard in C++ is the day that niche is basically done (on the scale short of introsort pushing out quicksort). GUI programming is by no means a done deal yet; the Adobe people are working up some very interesting tools; Mozart is investigating along similar lines; there's also a smaller personal project that uses embedded DSL in C++ (Boost.Spirit style). Until the One-True-Abstraction blows everything else away, you get the choice of making your own bed and lying in it.
What I'd like to see a change in the Language, is to allow putting a class's private members into the implementation. Currently, any change to a private member causes recompile for all files that include it. This is a huge problem for large projects. Implentation helper class can solve this but developers should not have to do it.
button.onClick(myObjectType *myObject) {
myObject.handleClick();
}
"...C++ must grow..."
What other programing language can say it has a rapper named after it?
C# is much more than a "Windows programming language". There is a vast amount of C# code available on Mac and Linux, and C# is a standard, not just a MS language. Mono, heard of it?
Many of the criticisms below are very thoughtful. However, I'd say that the many of them in some way simply indicate a lack of knowledge about C++. (I'm not trying to sound arrogant, I really mean this.)
/. the excellent book "C++ in a Nutshell" from O'Reilley. It is very well written and explains and answers many of the questions posted here.
I'm recommending to
In my view, C++ is an excellent tool. Contrary to the view that it's dated, I believe that "Standard C++" is under-used and sometimes not even considered for reasons which simply aren't valid. I encourage readers to get the above book and do some discovery for yourself. As the language's primary creator says, libraries are were most of the features are needed.
1. Because you cant write an operating system in java or c#
2. Because Java eats memory at breakfast
3. Because Java GUI's are damn slow
4. Because C++ is open
6. Because you dont have low-level control in Java
7. Because C++ binaries are smaller than a java vm or the c# runtime
8. Because c++ runs everywhere (though not with the same binaries/code)
And then Microsoft did it right, with C#. Really. It's like C++ version 3, i.e. the one that finally works the way it's supposed to.
If you were blocking sigs, you wouldn't have to read this.
Yes, I have heard of Mono, which last I checked does not include major parts of the core C# libraries. How many major linux applications are written in C# ? I agree that it's a standard. But it is originally designed, and implemented, as a Windows programming language. For example, it is designed to run on an operating system that has a number of features including support for graphical user interfaces and multithreading. It is not a general purpose programming language in the same sense that C++ is.
C# is what C++ always wanted to be. It was written by people who had learned from the mistakes of C++ and Java. It's not perfect, but it's better than either of the others for the majority of desktop and server applications. Anyone who tells you otherwise is a Microsoft hater, or isn't working in that problem realm.
You might also want to have a look at the D programming language, which is a ruthlessly pragmatic alternative.
If you were blocking sigs, you wouldn't have to read this.
C# can be compiled without any problems in almost all platforms
What will we talk about if there aren't endless discussions on DCL (double checked locking) in the C++ and threading newsgroups?
Obviously. The same goes for any language. But what do you propose to replace it? The vast majority of "modern" languages are not compiled to machine code. For the moment, C++ is a good balance between the efficiency of C and the user-friendliness of higher-level languages. It fills a niche (resource-gobbling 3D games, operating systems, compatibility with C/C++ libraries, etc) that no other language does.
LOAD "SIG",8,1
Thats not the point - the compiler will still have the code and do it exactly as before. The point is that now when you use an incompatable type with a template instead of the compiler giving you a nasty error somewhere in the actual code for the templated thing it will appear at decleration - where the error dam well should be. None of those 8 line errors that make you head want to explode, and something that a newbie might understand.
1. signals & slots. These *must* be introduced. Event handling is a breeze with them.
2. make it mandatory for allocations to be deallocated in the heap they were allocated, that is, for example if you allocate memory with new or malloc() in a DLL, and you deallocate it with delete or free(), then the deallocation must be done in the DLL. This could be done with some tables storing the heap for each allocation. This is *very* important if you work with several DLLs in your project, since if you deallocate something that was allocated in a different module, the system crashes because you try to deallocate in the wrong heap. Especially STL containers cause a lot of trouble with DLLs.
Well, this can be solved by overloading the new & delete operators; also, choosing "multithreaded DLL" as CRT in VisualC is a solution, since then all "multithreded DLL"-Modules share the same heap. Nevertheless, this is something that should be dealt with in the language.
This sig does not contain any SCO code.
-1 Troll??
Come on, that post should have been modded +100,000 Funny. Man, that just made my day.
Another unmarried marriage guidance councillor.
If you were blocking sigs, you wouldn't have to read this.
Perhaps my prayers will be answered and they'll finally add the COME FROM statement to the C++ standard.
Oh God, please, no!
C++ desperately needs some basic functionality in its standard library: concurrency, GUI, maybe things like sockets. (Alas, by the standards committee's own admission, some of these -- particularly the GUI one -- are unlikely to happen.)
What C++ doesn't need is for its relatively simple but useful standard library to be overwhelmed by every template freak and his brother's pet ideas, which is very much the direction a lot of the "in crowd" and a lot of Boost contributors are tending towards at present.
By all means, let library designers use whatever language features are useful in whatever ingenious ways they can, but please let the interface for anything that actually gets into the standard library be simple and effective, not infinitely customisable but massively over-complex. That means some parts of Boost would be excellent additions, but others certainly would not.
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
I know that's a relatively intangible question to quantify but I did find a survey that lists different programming languages used in the workplace. Seems as if C++ definitely isn't dying just yet. I found another seemingly google-based article on the popularity of various programming languages. Sure Java and C# are up there with PHP thrown in as well, but C++ still has lots of current uses. Seeing I am hooked on Ruby in my workplace I am one of the few according to all of these figures :-)
Last time I looked at the Roman numbers, V == 5 and X == 10. So, if you use your logic, 0x would be 010 which is not, in any way I can see, 2005.
For a moment there I thought I was looking at a new function name. No offense intended.
Interesting article, no attempt to learn from the mistakes other languages have made. No observation that India/ China/ Pakistan are the new markets. No acknowledgment that the programming IT market is shrinking. C++ was previously just lucky as its previous early adopters were not primarily professionals but were more importantly enthusiastic. As India grows a crop of new low paid professionals just how long will C++ stand up in a world with substantially better language / framework and practical alternatives? 20 x 20 hindsight show that "No substitute exists for being in the right place at the right time" Stroustrup forgets the time,
I think there has to be a better way than extending C++ again. It's ugly enough as it is.. why make it any worse.
.h files directly and link directly with C and C++ libs, and allow transparent support for various object models (COM, CORBA, C++, .NET, etc.) This should be possible through user defined implementations of basic compiler types. It should just work, and if it doesn't, the user should be able to make it work by programming an extension.
..would be converted to a dynamic array, static array, or a sequence of statements depending on how it was used. The code that did this specialization would not be part of the compiler itself, but instead part of the library that defined Array, which would have access to the compiler parse tree and other information to allow it to correctly specialize the expression.
I propose a different upgrade path. If the goal is a bare metal system language with zero overhead, minimal code size, and maximum speed, and easy to code, I propose the following.
1. Base the syntax on a standard existing language such as Java or C# with either no changes or minimal changes. Both of these languages have a more elegant higher level syntax to start with, and a large established code base and existing programmer expertise. All other system level language features would happen "under the hood". This would allow the use of existing code.
2. Compile to machine code. System languages must compile to machine code.
3. Support pointers, unions, etc. as special unsafe code. C# already allows this, so C# makes a better choice to derive a systems level language.
4. Include
EFFICIENCY and OVERHEAD:
A systems programming language must dispense with any unnecessary run time level overhead, access hardware directly, allow the programmer to control every single expression of any language features in actual code, and permit the programmer or library designer tools to produce maximally efficienct programs. To do this:
3. Support class and type specialization based on static code analysis and dynamic profiling. In this theoretical language, classes and types are not single concrete entities directly converted to code as is (as in C++, C#, Java, etc.), but abstract representations which are replaced by multiple possible implementations depending on their actual usage.
4. Provide a mechanism for library programmers to provide extensive compile time class specialization and program wide optimization via code analysis and runtime analysis. The goal is to provide the user with simple classes with behind the scenes complex optimization strategies. An extension of the simpler statement level optimization in ordinary C and C++ compilers to classes and methods/functions.
For example.. the statement:
Array a = { 10, 20, 30};
5. Use this same program code analysis to provide automatic memory management instead of a general purpose memory manager.
6. Allow the program to add constraints to code which will allow further optimizations, for example maximum string or buffer lengths, concurrency or threading rules, etc.
7. Allow dynamic libraries to request additional information for additional potential optimizations, or suggest additional program constraints which if chosen would allow further optimizations.
8. Permit the addition of limited new syntactic elements to facilitate elegant coding of narrow problem domains.
9. Permit the library designer to parse and interpret literals. The representation of any literal would depend on the type the literal is assigned to. (Example: string literals might be compiled as a zero terminated string when assigned to a StringZ type, or a length/char when used with a StringLen type.
10. Provide a superset of C++'s semantics using the generative and specialization coding features when necessary. The flexibility of the generative code feature should be adequate to encapsulate the details of a C++
C++ is the only major language with extensive abstraction but without memory safety. All other major languages are either memory-safe or don't hide the underlying machinery. (Java, C#, VB, Perl, Python, etc. all have automatic memory management. Some use garbage collection; some use reference counts. C is unsafe, but hides nothing.) This fact is responsible for millions of program crashes every day. Most security holes in C++ code come from this problem. Java and C# were invented primarily to eliminate the safety problems of C++. The open source community has generally stayed with C, where at least you can see by examination what's going on. C++ is losing market share to Java.
And Strostrup denies this is a problem.
This has happened before. Last time, it was Wirth. Wirth designed Pascal, Modula, and Modula II, but refused to admit that each had serious problems. He fought external compilation in Pascal. He fought extensions to the language. He even fought compile-time arithmetic. In the end, he took Pascal from a major language to a historical footnote.
Serious systems programming was once done in Pascal, but not in Wirth's version of it. The original Macintosh and Lisa software was written in nonstandard versions of Pascal. And much of the DOS era was built on Turbo Pascal. But proliferating nonstandard versions of Pascal caused another set of problems.
C++ has been in decline for years. "Evans Data has found that the percentage of developers using C++ has steadily declined over the last six years--from 76 percent in the spring 1998 to 46 percent in fall 2004." Strostrup also denies that.
The C++ committee has been taken over by template fanatics. Most of the committee's effort revolves around obscure template features that few will use, and which no responsible programming manager would allow on a mission-critical project. There's very little interest in language safety, and a vocal minority that insists language safety is undesirable or impossible.
All is not well in the C++ world. Claming otherwise is irresponsible.
...is that they're already in use.
Remember that, when the language syntax was designed, the idea was that every conforming C program would also be a conforming "C With Classes" program. Identifiers like "abstract" and "interface" were already in use as user variables, types, functions, etc.
I think you would be pretty pissed off if the next revision of your dawn-to-disk programming language suddenly made "foo" or "i" a reserved keyword. :-)
Time has passed and the two languages no longer fit together like that. Hell, they barely resemble each other anymore. But even ignoring C, now there are valid C++ programs which use "abstract" and "interface" as identifiers, so the problem remains.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
and C++ and possibly some assembler
they would laugh at someone who said they only programmed C.
First, with ISO-quality standards, updates are made carefully and slowly to insure the least pain to all users relying on the standard. Backwards compatibility is usually the most important concern to the maintainers; there's no "willy nilly" changing going on. [Compare this to say Java, whose specs change much more quickly and perhaps more "willy" than C++]
There are many reasons to update standards periodically:
1. Most standards bodies (such as ISO) *require* that all standards be updated, or at least re-affirmed, on a periodic basis; usually once per decade. Otherwise they are considered abandonded and "revoked" from having its standard status. This helps weed out truely abandoned standards as well as insures that the standard is properly maintained and retains its usefulness.
2. As with most language standards, there are always many many small technical imperfections, or more commonly ambiguities, that need to be addressed or clarified. Most of these will never affect the "common" programmer, except perhaps those on the fringe (such as with embedded systems and so forth).
3. Practical experiences with a language often show shortcommings that, although may be technically minor, greatly detract from the language's usefulness in some cases. For instance when the C standard was last updated they made the numerical semantics much tighter (because they found out FORTRAN programmers could not adequately port programs to C without them). These changes would be hardly noticed by most programmers who don't do heavy and precise computation; but greatly welcomed by those who did.
4. Sometimes novel techniques or components are invented which prove to be very general solutions to widely-encountered problems, and which fit the "style" of the language very closely. Once these experimental components are deemed very mature and stable, adding them into the language proper can benifit all language users. For C++, many of these new extensions come out of the Boost project. But only the most mature and the most general-purpose extensions should be considered for standardization.
For a look at what's on the C++ issue lists, look at http://www.open-std.org/jtc1/sc22/wg21/
I prefer to think of that volume as "The Design Rationalization and Mutation of C++". An astounding amount of it is Stroustrup explaining why one feature or another would have been a good idea, but had to be shelved in favor of something simpler to implement, or requiring fewer keywords to change. It shows the extent to which C++'s design was political in addition to being technical (see Lambda the Ultimate Political Party for how this worked in the Lisp community).
It's a good, informative read, though not always a fun one - I still gnash my teeth every time I read about how they settled on termination semantics for exceptions.
To a Lisp hacker, XML is S-expressions in drag.
D is a refactoring of C++ to make it easier, more powerful, and more robust to use. -Walter
I haven't RTFA but I just hope that Stroustrup has come to his senses and got rid of the 'friend' keyword.
I've never seen 'friend' used other than as a bodge to hide the fact that the original design was botched.
After many years of software development, I've never found any use of 'friend' where the rest of the code isn't really hacky too, or any good developer that would consider using it.
"Informative"?! Hmm...let's just rewrite the entire Roman Numeral system while we're at it.
The perfect balance of ease of use and richness of features for C++ is defined thusly:
If any novice is able to pick up Bjarne Stroustrups' The C++ Language and beat him within an inch of his life... but no more, then the book is perfectly balanced between ease of use and richness of features.
As it currently stands, I believe that every second or third novice would easily be able to beat Bjarne to a messy, bloody pulp almost as ugly as the code his language engenders.
So do we get a packed decimal datatype yet? WHat of Zoned decimal?
C++ is over with already, geez. Slow, cumbersome, and nobody has a compiler for it. You should be switching to Java by now. It's fast, portable, and the JVM is everywhere. The Novell JVM is the fastest. The time of C++ is past. Let the dinosaur turn into oil already and upgrade to the technology that will take us into the 22nd century and beyond. JAVA!
I feel like the C++ member function pointers are nearly useless in their current form. If the language supported the concept of a bound member function pointer, it would enable a lot of the nice things you can do in ObjC, and fairly efficiently.
if you have something like:
and want to pass my_foo->Bar(), the compiler should be able to output pretty much the same code as when it would actually generate a member function call, e.g., adjust the "this" pointer if neccesary, lookup the actual function address in the vtab, and then just store those two pointers. Actually calling through this "fat pointer" might even be faster than a regular virtual function call--just put the "this" part of the pointer into the appropriate register and then jump-to-subroutine-register on the function pointer (you could even load the "this" pointer in the branch delay slot on MIPS architectures). This would be incredibly useful, the main problem is coming up with a nice syntax that fits into the rest of the language. How about this one:This has always seemed to me like such an obvious, useful, and unobtrusive extension to the language, that I'm curious if there is some good reason why this hasn't been considered--e.g., is there some nasty case where this would be hard or impossible to implement, or is considered to violate some aesthetic principle of the language, or are what seem to me to be ugly workarounds considered acceptable by most people (and thus extending the language to support it would be "redundant")?I've been developing in Java exclusively for the last 4 years and haven't been following C/C++ at all.
Can anyone tell me what the following quote is talking about regarding enumerations?...
"Also, some 'random extensions' will slip through the net and become 'odd and isolated' features in the language (much as enumerations are in C and C++)."
More Libs? What about ACE and RogueWave and the so many C++ Libraries out ther for multithreading, logging etc. How about a Jave like 'interfac' keyword as a part of the language?
High level languages are built on top of other languages. After all, in which language are .NET or Java compilers written?
The good characteristic of C++ is that it's low level. It's the lowest-level language that is independent of hardware, except for plain C.
For this reason, C++ won't disappear. It will just evolve.
Of course, If C++ ends up being a compiler-only language (which is very probable), oh well. What can we do about it?
The largest problem with C++ is its complexity. It is not just too complicated, it is *unmanageably complicated.* Some of the symptoms are:
- The STL has inexplicable omissions. For example, there's no portable way to seed the built-in PRNG in the random_shuffle algorithm, rendering it useless.
- Guruhood isn't good enough. Consider the seemingly simple task of creating a stack that works correctly with exceptions. It's extraordinarily difficult even for a guru.
- Language features interact in nonintuitive ways, producing a combinatorial explosion. For example, if you overload a function in a class, you don't have to use the scope resolution operator, and if you override a function, you don't have to use it either - but if you do both, you DO have to use the scope resolution operator or else you get a compile error!
Insofar as the new C++ standard adds stuff, instead of simplifying, this will only get worse. Since it's unreasonable to expect a new standard to remove features, the problem is unfixable. The result will be that programmers carve out their separate comfort zones, compiler vendors will not implement all features, and the monolithic C++ language will fragment into a Venn diagram of sublanguages. More so than today.and Bjarne sounds as if he were rehearsing his pitch on the eve of a product launch. As if C++ needed to be re-launched! I wonder whether he does this because he fears people's reaction to the new standard. In any case, it seems he hopes to preempt a good deal of criticism by manipulating our view of the standard's gestation ahead of the release. We've seen this kind of thing before, haven't we?
Technique Before the launch, persuade clients to believe that the product's development was/is governed by core values they already hold. Result After the launch, clients are less likely to look at the product critically and dispassionately because they are already satisfied that it respects their core values.But maybe that's what a language creator ends up having to do if he wants changes to be widely accepted and (more importantly) adopted so that the language does not become stale. Yes, "the end justifies the means" and all that jazz. That might account for the delay in the delivery of Perl 6 and the endless series of Exegeses and Apocalypses and Ecclesiastes and whatnot.
What I don't fully understand, then, is why Bjarne spoils an otherwise excellent pamphlet by indulging in the pointless denunciation of enumerations as an "odd and isolated feature" born of or comparable to (it's not clear from the phrasing) a "random extension" that was included in the standard due to operational deficiencies in the standards process. Is this flamebait, tossed our way to draw attention to his article and to the standards process? Certainly, he isn't trying to discredit the process by acknowledging the inevitability of incorporating "random extensions" that would later become "odd and isolated" features, is he?
The list of languages above is a good start, but is actually pretty narrow - they're all mostly imperative and Algol-like. For real breadth, you should break out into one or more of:
Common Lisp, Scheme
Haskell, ML, ocaml
Smalltalk, ruby
Prolog
To a Lisp hacker, XML is S-expressions in drag.
THe one thing I've wanted forever is for it to allow multipel returns from one function. The idea of a function returning one variable comes from math. It doesn't really port well to CS. In CS, its frequently useful to get 2,3, or more pieces of data back. This forces us to one of several hacks- either return a class with all the fields, use input/output variables, or for error returns use an exception.
Something similar to the following is what I envision:
int,int foo();
int a,b;
a,b=foo();
Foo would *always* return 2 variables, and the type would always be known, so we don't lose type safety. But we would gain the ability to read 2 pieces of data.
I still have more fans than freaks. WTF is wrong with you people?
I write this as it is my personal experience:
I first learned Java and then C++.
Shortly after learning C++ I learned wxWidgets (it was named wxWindows then). To make a long history short, I only missed serialization from Java, almost everything else felt better in C++/wx than in Java, especially GUI stuff.
And one of the reasons for it is that wx doesn't use C++ templates at all. No bloated code. It's even simpler to use than Java.
Well the other thing that I miss from Java is JDBC. wxODBC is just ugly (looks like MFC code).
We are Turing O-Machines. The Oracle is out there.
I said it once... and say it again.
Why copy a bad API when there are better alternatives?
wxWidgets is to C++ like gas is to cars.
We are Turing O-Machines. The Oracle is out there.
Nice article. I love C++.
From the article:
> "The most commonly requested new feature for C++ is a standard GUI. The technical, economical, and political odds against that happening are immense."
IMO standard GUI is danger because: 1) there are very different GUI API/protocols (X-Window, Win32, etc.); 2) complex to implement and maintain (consequence of the previous one); 3) there are other areas with different needs and wishes (specific widgets, 3D, GUI threading, theming, and so on); 4) there are currently useful portable open source C++ toolkits (i.e. FLTK, Qt, FOX).
The vast majority of "modern" languages are not compiled to machine code.
No, the vast majority of modern mainstream languages aren't compiled to machine code. Haskell, ML, Ocaml, Lisp, Mercury, etc. all compile to machine code.
For the moment, C++ is a good balance between the efficiency of C and the user-friendliness of higher-level languages.
That may be true if you equate "higher-level languages" with "Java, C#, Perl and Python," but that's not even close to the full spectrum.
It fills a niche (resource-gobbling 3D games, operating systems, compatibility with C/C++ libraries, etc) that no other language does.
Almost any language can interface with C libraries, because they're the de facto standard.
Do you know of C++ being used in the kernels of any mainstream operating systems (or even many non-mainstream ones)? C is still king here, as far as I know, because when people write operating systems, they want to be as close to the metal as possible, and don't want all the abstraction that C++ provides.
Please explain why you couldn't write 3D games in, say, Ocaml.
I've come for the woman, and your head.
...because Microsoft will put it everywhere for you! Think DirectX...OK, bad example.
As C++ programmer I always wanted to have a language that supported symbolism. I understand why Bjarne wants to call it C++0x but without some AI it whould be hard todo, if you get the point. Putting todo in a library is indeed the catch. To reuse or not to reuse... S++ ?
ngen dot exe
.NET code is interpreted by the Common Language Runtime Just-in-time compiler, and ngen can compile all necessary code to native binary. AFAIK, you'll still need the CLR on-site, since it doesn't package system libraries...yeah, it can be done.
All
--- What
More and more application will be writen in Java, on sourceforge the number of Java projects is just behind C++, just a few hundred. There are a lot of Java enabled cell phones, the game market for Java is currently not realy big but is growing and will grow more in the future when more tools come availible for Java game development.
There are a lot of other areas were Java shows up, realtime software, at NASA for ground-site control but in the future (2009) also on the mars rover. Or the unmanned aircraft (scaneagle) of boeing, parking tickets systems, in the Formula One, the Automotive Industry and healthcare.
It is just getting hard to find an industry (that uses software) where Java is not in.
There is still lot of code written in C++ but I think it will be hard to stay popular and most used computer language, but we will see that within the next 5 to ten years.
Any "rough corners" shaved off had better leave a syntax that resembles the subset most people bother to learn. It's always fun to watch obvious code change from plain and sincere to incomprehensible because some genius decided to wrap the grammar in an "obviously useful" abstraction layer. Whenever this happens, I thank gad (aka Bill Goats) for giant corporations who think of customers before lighting up in their ivory towers.
``Tension, apprehension & dissension have begun!'' - Duffy Wyg&, in Alfred Bester's _The Demolished Man_
I used to think C++ was the best general purpose programming language, until I met LISP. At first, I had difficulties understanding it, but after playing with LISP, I realized how much more powerful than C++ is.
I suggest everyone to read the material at lambda-the-ultimate. You will be surprised on how little you know on programming languages...it was a real eye opener for me.
This Slashdot discussion is pretty cool.
If you read the rest oof the thread, you'll see that almost the whole thing is full of deep, intelligent and well-reasoned arguments on both sides of the GC in a language issue and so on.
I can't remember the last time I saw so little bullshit in a Slashdot discussion. It makes a nice contrast with the amount of nonsense which follows any article about greenhouse gases. People for and against the theory say many ridiculous things.
Slashdot geeks, listen up! When you stick to talking about things you actually understand, you become less objectionable! Social tip of the day!
Java doesn't force you to use OO design and type introspection any more than C forces you to use a procedural design.
Karma: It's all a bunch of tree-huggin' hippy crap!
C++ has real-world applications now?
Ron dies in chapter 9 of book 7.
I apologize. I should have said "invented recently" rather than "modern".
Please explain why you couldn't write 3D games in, say, Ocaml.
Functional languages are neat, but most programmers are more comfortable designing a large system in an imperative, object-oriented language. Functional idioms can be rather unintuitive, even to those with decent CS educations.
LOAD "SIG",8,1
Functional languages are neat, but most programmers are more comfortable designing a large system in an imperative, object-oriented language. Functional idioms can be rather unintuitive, even to those with decent CS educations.
...." I don't find that sort of argument a compelling reason why people should continue using C++.
Perhaps, but I think that's largely a problem of education rather than some intrinsic difficulty that functional languages possess. Most programmers are trained to use imperative, object-oriented languages from the get go, so switching to functional languages is a significant shift from everything they've learned before. However, I don't see why functional programming would be significantly more difficult if people learned it from the start.
In essence, such an argument reduces to something like, "everyone knows C++ now, so it's easier to keep using C++ like languages, so everyone will continue to know C++,
Ocaml does have an object system, and you can write imperative code in it, so you could likely even write code that's rather similar to C++ in it, too, although that would not be the best way to solve most problems with it.
I've come for the woman, and your head.
Thank you for a thoughtful reply.
To an extent, I agree with your position: I don't favour all-encompassing libraries a la Java, and I do prefer somewhat centralised but community-driven framework's like Perl's CPAN or TeX's CTAN.
However, I think a certain amount of pragmatism is useful. To pick on the GUI library as an example, it's certainly true that many C++ programmers write GUI code, though many more do not. If you do, then whether you're using MFC or wxWidgets or Qt or Yet Another Clone Windowing Library, the basic concepts are very much the same.
In light of this, I believe that a standard library should provide a simplified framework of basic functionality in this sort of case, upon which more powerful non-standard extensions can build if they wish. There will always be platform-specific libraries, not least because not all platforms have the same capabilities, but the needless duplication of effort between all of the libraries I mentioned just above is an impediment to portability without benefit. Why not commoditise the common ground, and leave the specialist library guys to focus on the more powerful stuff in their respective fields, without that unnecessary duplication of effort, and without creating artificial barriers to portability?
For bonus points, this also provides useful basic features for the many applications that only use a simple GUI anyway. In addition, you reduce the learning curve for both the langauge and any libraries building on the standard framework, and make it easier to teach the language to beginners.
You can make much the same argument for many other fields, where a very large number of programmers do essentially the same basic thing, with different bells and whistles on top. C++ excels in providing tools for flexible, extensible, customisable code in libraries: classes, templates, overloading, RTTI, exceptions, and more. Of all the mainstream programming languages in use today, I think C++ is perhaps the most suitable to this framework-based approach. Over a million programmers are going to wind up using MFC or Qt or wxWidgets or whatever anyway, so it seems overly pedantic to restrict the scope of a standard library because a GUI component couldn't be used everywhere. After all, taken to the logical conclusion on that basis, you're not allowed any sort of file access, either, but I can't imagine any language hitting 3 million users if you had to download additional libraries just to open a file!
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
It's about time there were man pages for C++ the way there are for C.
I'm no C++ guru (I know enough to make mistakes), but I do know that the language gives as much or as little control as the programmer desires. Just like C and assembler.
After reading the posts in this thread, I can only derive that the most of the Python/Java/Perl/C#/PHP/Ruby crowd have no idea how thier interpreter of choice is built. All are built using C/C++ or a combination of both.
It's really disturbing that most of these programmers have no idea on how thier interpreter of choice interacts with the processor or the OS its running on.
It's downright stupid that most of the interpretive programmers blame the security issues on C/C++ and not the program vendor for shoddy code.
No flamewar intended. Food for thought.
Enjoy.
It's just the normal noises in here.
Congratulations, you've taken another step in the journey of learning to program. However, your conclusion is a little premature.
Some of us took that step a long time ago, lured in by the power and flexibility of functional programming languages, and the elegant simplicity of LISP in particular. And many of us came back, giving a polite nod to those languages, understanding some programming concepts a little more deeply than we used to, even wishing we could bring some of the neater stuff with us, and yet still returning to tools like C++ or Perl or Java for our serious work.
Why did we do this? The theoretical power of functional languages is undeniable, and for sure many of the current mainstream languages could learn more than a trick or two from them, but they tend to sacrifice practicality for purity. Lazy evaluation and side effects make ill bed-fellows, for example. In my universe, we frequently use side effects for I/O, and we do not consider monad-based techniques, however clever and theoretically pure, to be an adequate substitute when we're writing more than toy examples. Similarly, while LISP macros are awesomely powerful, for most jobs some well-thought-out and standardised syntactic sugar will offer more benefit.
It's perfectly possible to gain many of the advantages of functional languages in more mainstream alternatives, simply by adapting your programming practices: write in a more declarative style with liberal use of const, for example. However, at least in C++, you have a choice. In a strict functional language, you don't, and that's a deal-breaker for most programming jobs.
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
OK, I'm a bit of a C++ fan (I like practical tools), but let's keep this in perspective.
The containers/iterators/algorithms parts of the C++ standard library are real.
They mostly work, aside from the glaring omissions (hash tables? circular lists?) and design blunders (vector<bool>? basic_string?).
They don't really rock. The containers are handicapped by the absence of corresponding literals, which even the practical monstrosity that is Perl can do. Many of the algorithms are crippled by the lack of first-order functions and the like, and look like a strange attempt at humour to anyone familiar with functional programming languages. Numerous articles have been written by clever people about how to get these C++ features to almost do something using a page of code that other languages can do in one line described in the first chapter of the book.
And the performance is OK, but since compilers still have to accept underlying aliasing concerns and the like, it's still somewhat held back compared to a more robust type system that didn't allow for things like pointer arithmetic.
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
I know this is a bit off-topic, but I have always wanted to learn C++. I already know a tiny bit (real basic stuff, like "cin/cout", function declaring, and I've just scratched the surface of classes). Does anyone have any good C++ book tutorials/references?
It's either Plain Old C, or so full of hacks and obfuscation that it was unreadable (or at least unfollowable). I mean, when you see 'friend' everywhere, that can't be a good sign.
C++ has way too many nice to have features that torpedo large projects long term development and maintenance costs.
.NET framework or Java class libraries).
Most, if not almost all C++ projects, could be implemented in a simpler language without too much trouble given an ANSI standard for a compiled into machine code C# or Java with a minimal subset of standard libraries (file i/o, time, string processing, and console input/output).
This is why I propose a C++ subset ANSI standard that essentially is the same level of language features found in C#/Java (not including the
I'd like to see GCC and MS C++ compilers allow for specific C++ standard language features to be disabled:
multiple inheritance
C style code
classes without a namespace
friends
default constructors / copy constructors
non-virtual destructor
Extra featues to be added:
strict keywords for
abstract base classes,
sealed classes
free/dispose/delete pointer sets pointer to NULL
invariant conditions for a class (e.g., member variable X must always be > 5 and 10)
I learned C++ when the first affordable compilers became available for the PC, about 15 years ago. I even wrote a multitasking kernel using C++. Then I didn't use it for a long time. When I returned, it seemed Java had been developed and B.S. apparently revamped C++ to look more like Java.
C++ is died? Hmmm..., have you ever asked yourself which language Adobe, Microsoft, Macromedia, Mozilla, KDE, Opera (and many others) use to develop their flagship applications?
Someone told me that some C++ compilers or extensions added garbage collection, I was wondering if it had ever been added to the language definition.
Apparently, the C++ programmers here think that's a rude question, so I suppose the answer is "no".
TWW
"Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
(Yes, I know, that's not a particularly funny joke, but at least it's not Bjarne-yard humor.)
Those who sacrifice security to condemn liberty deserve to repeat history or something. - Benjamin Santayana
I do believe that it is impossible for recently designed automatic transmissions to be ripped to pieces by an engine. I've placed my car in drive to park on occasion (accidently) and it still works. The fact that there is no direct connect to the engine, and that the transmission works under hydrostatic pressure insulates it from a similar fate on a manual transmission of say, going from 5th gear to reverse (assuming the lockout broke).
And just about every recent automatic will cut off the engine once it red-lines. My plymouth voyager did, and my Mercury Sable do.
I mean come on already. M$ is still behind on the current standard and their shift to c# and
As the dominent player in IT (no, I don't like it either), whether they support it or not will be the critical determining factor in the adoption of any new standard.
The year that came after me studied Java entirely through OO coutesy of a vicious militant lecturer. They mostly did REALLY bad in their exams as the vast and complicated hirarchy of the JAVA class framework gave students less time to study more important stuff, like the algorithms and data structures. OO is overrated in general. It is just usefull for convention really. I'm open to other uses...
C++ is much more suited to beginners. The only real problem (a small one) pointers is it's weakness. You can write good programs in C++ quickly, and as paretn says, it doesn't take long before you can get to the nitty gritty of doing your own memory allocation/deallocation etc too ..
Still, it's different languages for different purposes. I believe Java is more sane overall however!
It's complete enough to use for major projects right now. What more do you want?
If you were blocking sigs, you wouldn't have to read this.
The functional style simply does not fit every problem. If you want to print text onto the screen, the most obvious way is to do a
t ext-printed-onto-it'
print 'device' 'text'
and not a
print 'world' 'text' : returns 'new-world-where-the-screen-has-the-next-line-of-
After all, computers are executing code and somewhere you do have to start, your haskell
session starts by imperatively invoking your haskell interpreter/compiler/program!