×

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

Thank you!

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

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

C++0x Finally Becomes a Standard

Unknown Lamer posted more than 2 years ago | from the c++-ain't-what-it-used-to-be dept.

Programming 398

Samfer writes "On Friday August 12th 2011, the results for the final ISO ballot on C++0x came in, and the ISO C++ Standards Committee were unanimous in favor of approving the new C++0x (for now unofficially known as C++11) object-oriented programming language standard which is intended to replace the existing C++ standard. The new standard is to offer new and improved features such as lambda functions, concurrent programming functionality, direct data field initialization, and an improved standard library to name but a few." Although I haven't heavily used C++ in years, it is nice to see a decade long effort finally come to fruition. Especially nice is the support for type inference which should save quite a few people from RSI and make refactoring code a bit less obnoxious.

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered

398 comments

Congratulations! (0, Interesting)

Anonymous Coward | more than 2 years ago | (#37109254)

They said it couldn't be done!

They doubted us!

But we did it!

The ugliest, most fragile, hackiest, most garbled, incoherent, biggest mess of a programming language is now even more so!

Re:Congratulations! (5, Funny)

Anonymous Coward | more than 2 years ago | (#37109294)

Wrong thread dude, think you were looking for:

http://developers.slashdot.org/story/11/07/28/1758221/Oracle-Announces-Java-SE-7 [slashdot.org]

Re:Congratulations! (1, Funny)

Anonymous Coward | more than 2 years ago | (#37110092)

Have you SEEN the stuff they're adding in the C++0x standard? Java has its warts, but it doesn't even come close to THAT level of horrific ugliness. I think APL is starting to have a competitor for unreadable code.

Clean cool crisp refreshing (1)

Anonymous Coward | more than 2 years ago | (#37109392)

I've been looking at 'C' code lately. Clean, cool, crisp and refreshing Standard K&R 'C'.
I see the small tight executables.
The fast load times,
The tiny memory footprint.
And I ask myself, "What have we really gained with C++?" or any OOP language, for that matter.

Re:Clean cool crisp refreshing (3, Funny)

nemasu (1766860) | more than 2 years ago | (#37109468)

Objects

Re:Clean cool crisp refreshing (1)

rubycodez (864176) | more than 2 years ago | (#37109780)

false, objects can be done in C as pointers to structs with members pointing to data and structures.. In fact, that's how the early c++ "compilers" did it.

Re:Clean cool crisp refreshing (1)

rubycodez (864176) | more than 2 years ago | (#37109792)

"pointing to data, functions and other structures (objects)", that is

Re:Clean cool crisp refreshing (1)

GooberToo (74388) | more than 2 years ago | (#37109958)

You can do objects via C but its hard to read, debug, error prone, frequently inflexible, and nowhere near as powerful as C++. Other than that, objects in C are a really good idea.

Re:Clean cool crisp refreshing (1)

Anonymous Coward | more than 2 years ago | (#37109906)

C is object based. All these *.o files guess never meant anything to all these newer programmers.

Re:Clean cool crisp refreshing (1)

TheRaven64 (641858) | more than 2 years ago | (#37109942)

Not really. The main advantage of objects is the loose coupling. C++, by requiring you to put the implementation details in the header, lacks that. Adding a single method to a class in C++ can require you to recompile the entire code base. This makes code reuse very hard, and the C++ type system makes it even harder. There are a few things that C++ is good for, but not many.

Re:Clean cool crisp refreshing (2, Interesting)

wagnerrp (1305589) | more than 2 years ago | (#37110098)

The whole point of classes is that you have create a relatively static interface, and the internals can change around as much as you want. If you change the internals, then all you have to do is recompile that single cpp file and re-link. If you change the interface, then you very likely will need to change many other files to use the new behavior. If you are changing private methods and private variables frequently, perhaps you should instead store them in a private class defined only within the cpp file, so you aren't constantly changing that header.

Re:Clean cool crisp refreshing (1)

Artraze (600366) | more than 2 years ago | (#37110134)

That's not particularly true. Actually, C++ makes life, perhaps, slightly easier because you can do:
class X;
class Y { X * var; };

vs. C where you'd have to write (note the repetition of naming the the word "struct"):
struct _X;
typedef struct _Y { struct _X *var; } Y;

In either language, you only need to include the typedef where you're actually using it (i.e. not just a pointer), and so only have to rebuild those parts if you set up your headers sanely. Sure, in C you can throw a function prototype in a .c and not the header, but that's more pathological than helpful. C++ is really about as competent as C (esp. considering it's a superset of the latter), but most developers don't really have the knowledge / background / inclination to actually use it that way.

Re:Clean cool crisp refreshing (0)

Anonymous Coward | more than 2 years ago | (#37109522)

The ability for idiots who shouldn't be programming in the first place to use something *easier* at the cost of society at large.

Security is also an elective in a CS course these days, but Web Dev is mandatory.

Hmmmmmm.

Re:Clean cool crisp refreshing (1)

codegen (103601) | more than 2 years ago | (#37109588)

In our program, security is covered in a core required course and web dev is in a technical elective.

Re:Clean cool crisp refreshing (1)

Niris (1443675) | more than 2 years ago | (#37109628)

I would love for even that to be true. Fresno State doesn't offer any security classes currently (though they're looking into it) for their computer science course. Web Dev is a class offered for one of the elective strings, but it isn't mandatory as there's other course branches you can focus on which is cool.

Re:Clean cool crisp refreshing (1)

superwiz (655733) | more than 2 years ago | (#37109896)

The ability for idiots who shouldn't be programming in the first place to use something *easier* at the cost of society at large.

The ability of arrogant jerks who don't realize that trivial nonsense is not a neat trick (but it does trespass on others' attention span) to complicate trivial tasks, to ignore solutions to problems which have been around for 20+ years, to take pride in their ignorance a la 1990... meh... why do I bother is the question. You deserve you.

Re:Clean cool crisp refreshing (1)

NoNonAlphaCharsHere (2201864) | more than 2 years ago | (#37109576)

1) Multiple inheritance "it's a floor wax! it's a desert topping! it's both!"
2) Operator overloading: because TimeCard + MoveTicket + WorkOrder is so much more readable
3) Virtual destructors: because the concept is so easy to explain.

Errrr. Give me a minute. I'm sure I'll think of something.

Re:Clean cool crisp refreshing (3, Insightful)

Brannoncyll (894648) | more than 2 years ago | (#37109668)

Correction:

2) Operator overloading: because

Matrix A, B, C, D;

A = A+B*C + A*D;

is so much more readable than

Matrix A, B, C, D;

A.equals(A.plus(B.mult(C)).plus(A.mult(D)));

.... oh wait, it is! This is why Java sucks and C++ rocks for scientific programming.

Re:Clean cool crisp refreshing (0)

Anonymous Coward | more than 2 years ago | (#37109742)

Do not forget the real template mechanism and stuff like the typedef operator that are really missing in Java

Re:Clean cool crisp refreshing (3, Interesting)

wsxyz (543068) | more than 2 years ago | (#37109756)

But the winner is:

(+ A (* B C) (* A D))

Filter error: Don't use so many caps. It's like YELLING.

Re:Clean cool crisp refreshing (1)

superwiz (655733) | more than 2 years ago | (#37110136)

Shouldn't it be:

(+ A (+ (* B C) (* A D)))

or did you mean this:

(+ (+ A (* B C) ) (* A D)))

Filter error: Don't use so many caps. It's like YELLING.

Re:Clean cool crisp refreshing (1)

NoNonAlphaCharsHere (2201864) | more than 2 years ago | (#37109868)

Operator overloading is only useful for a miniscule number of BigNum math classes that have all already been written - ages ago. By the way, did you ever notice how Java overrides '+' for the String class? So you CAN use overloading in the language spec without exposing it to the world for ametuer abuse. My 2Â.

Re:Clean cool crisp refreshing (0)

Anonymous Coward | more than 2 years ago | (#37109948)

Or examples like this one from the MPL docs:

Now, if we want to compute the force exterted by gravity on a 5 kilogram laptop computer, that's just the acceleration due to gravity (9.8 m/sec2) times the mass of the laptop:

quantity<float,mass> m(5.0f);
quantity<float,acceleration> a(9.8f);
std::cout << "force = " << (m * a).value();

Our operator* multiplies the runtime values (resulting in 6.0f), and our metaprogram code uses transform to sum the meta-sequences of fundamental dimension exponents, so that the result type contains a representation of a new list of exponents, something like:

mpl::vector_c<int,1,1,-2,0,0,0,0>

Nice try, sonny. (0)

Anonymous Coward | more than 2 years ago | (#37109996)

1) Multiple inheritance "it's a floor wax! it's a desert topping! it's both!"

BFD. All it does is obfuscate code. There are so many times when an inherited class doesn't do what it should or acts wacky because of something in the inheritance chain.

2) Operator overloading: because TimeCard + MoveTicket + WorkOrder is so much more readable

Really? Ever come across something like this:
'TimeCard >> MoveTicket' or 'TimeCard | MoveTicket' or some weird thing that does nothing like what you'd expect?
I've seen really crazy operator overloading in my time and many times completely unnecessary and hides so much functionality that without stepping into source, you'd never figure it out.

3) Virtual destructors: because the concept is so easy to explain.

pffft.

Errrr. Give me a minute. I'm sure I'll think of something.

All those reasons are fluff. None of them are really that compelling.

Now, if you mentioned something that actually makes C++ shine, like the STL where it saves work with a tried and true implementation, then you may have had something. That and and GUI frameworks are the only things I'd miss if I just programmed Standard C.

Back when C++ first came out to the general public (1990 IIRC), it was nice. It just enough nice features that increased programmer productivity - that's the only benefit of OOP, btw. And the sucky part is with all these features, programmer want to use them. One of my biggest pet peeves is programmers who use a language feature because it's there; not because it adds to ease of development - like creating a template for a class that will never, ever use anything other than a LONG. Why create a template with all of that compiler baggage and subsequent bloat?!?

I blame OOP as one of the reasons for the increasing bloat of software.

Re:Nice try, sonny. (1)

Anonymous Coward | more than 2 years ago | (#37110072)

Remember to test your sarcasm detector twice a year and replace the batteries regularly.

Re:Clean cool crisp refreshing (0)

Anonymous Coward | more than 2 years ago | (#37109696)

I had a program in C which did some preprocessing of a directory full of (large) text files every day. When the format of the files changed, I toyed with the idea of fixing the C program and then decided to just rewrite it in Ruby. It took about 45 minutes to write and test (and I'm not a Ruby expert by any means) and it's less than 100 lines, compared with the 1000+ line C program. I call it a win for Ruby.

Though it is true that the C program ran to completion in about 20 seconds while the Ruby program takes 2 or 3 minutes to do the same job, but it's not a time-sensitive task so that doesn't matter.

Re:Clean cool crisp refreshing (1)

CnlPepper (140772) | more than 2 years ago | (#37109954)

Wow, you learnt to use the right tool for the right job... and your point is?

Re:Clean cool crisp refreshing (0)

Anonymous Coward | more than 2 years ago | (#37110058)

...And I ask myself, "What have we really gained with C++?" or any OOP language, for that matter.

Re:Clean cool crisp refreshing (3, Insightful)

mangu (126918) | more than 2 years ago | (#37110084)

It took about 45 minutes to write and test (and I'm not a Ruby expert by any means) and it's less than 100 lines, compared with the 1000+ line C program. I call it a win for Ruby

Challenge accepted! I bet I could rewrite that program in less than ten lines of Perl code. Any takers?

Seriously now, I've tried nearly every language I can put my hands on. I still use C when the going gets tough. One of the reasons is that C is not likely to change.

I've done a lot of small systems in Python lately and, yes, for a small system I can get it going faster than in C. HOWEVER, now comes Python 3. They tell me now that I should have used "from future import division". Apparently I'm too stupid to read the proper documentation, it was clearly stated in PEP 947, or something like that, that the behavior of the division operator would change. It seems that I should read carefully every single one of those thousands of PEPs to make sure they won't pull the rug from under my feet.

If I ever have to go through every division operation in a program to check which ones can stay as '/' and which ones have to be changed to '//' I will take the opportunity to rewrite that program in C, as, I can see it clearly now, I should have done from the start.

Re:Clean cool crisp refreshing (1)

bonch (38532) | more than 2 years ago | (#37109802)

You probably posted that comment using software written in C++.

nyah! (1)

Thud457 (234763) | more than 2 years ago | (#37110094)

You probably posted that comment using software written in C++.

And you probably posted the comment using software written in C.

Re:Clean cool crisp refreshing (1)

Artraze (600366) | more than 2 years ago | (#37109840)

K&R C? Like the one where parameter types are listed after the function declaration? I'll take C99, please.

Otherwise, I agree. C++ and object oriented programming in general are a backwards way of programming that introduces a lot of mess and anti-patterns for the platform you're actually programming. Allocating global memory for local scratch space and string operations, for example, blows my mind.

That said, there are nice points to C++. Templates offer some capabilities and a lot of readability one doesn't get with macros (and vice versa!). Operator overloads are often nice for 3D / scientific programming. And like it or not, inheritance is quite helpful when it comes to GUIs. I just wish people would approach these things as tool rather than necessities.

Re:Clean cool crisp refreshing (3, Insightful)

ArcadeNut (85398) | more than 2 years ago | (#37109860)

Encapsulation
Polymorphism
Productivity

To name a few....

Re:Clean cool crisp refreshing (0)

TheRaven64 (641858) | more than 2 years ago | (#37109974)

Encapsulation

You mean like how C encourages you to use opaque types in the header and hide implementation details, while C++ requires you to use the Pimpl pattern to do the same thing and forces you to expose implementation details in the header by default?

Polymorphism

See Apple's CoreFoundation framework for a good example of how this is done in C.

Productivity

Yup. Long compile times certainly make me more productive. Posting on Slashdot while a big C++ project takes 10 minutes to recompile because I added a field to one class in a header and triggered a complete recompile definitely makes me more productive.

Re:Clean cool crisp refreshing (1)

superwiz (655733) | more than 2 years ago | (#37110154)

Turn off intern'ing during development and only turn it on for releases. This will speed up compilation considerably.

nice, but still missing... (2)

StripedCow (776465) | more than 2 years ago | (#37109296)

List of missing features:

- coroutines
- multi-stage/active library programming (i.e., something that fixes the syntactical mess of most template libraries)
- precise garbage collection (not that I'm missing it)
- fully opening up of the memory model (allowing libraries to implement complex memory handling such as garbage collection or persistence)

Re:nice, but still missing... (0)

Anonymous Coward | more than 2 years ago | (#37109466)

Heck, I just want to be able to do a dynamic allocation with a specified alignment and control the construction order of my global variables in a portable way. I've given up on complete memory ordering and barriers.

Re:nice, but still missing... (0, Insightful)

Anonymous Coward | more than 2 years ago | (#37109548)

What is it with lazy/shitty programmers and garbage collection?
If you can't be bothered/figure out how to free memory when you're done with it do the rest of us all a favor and stop programming.

Re:nice, but still missing... (0)

Anonymous Coward | more than 2 years ago | (#37109598)

Funny, I feel the same way about A.C. posts...

Hey Look! It's That Shit Coder StripedCow! (0)

Anonymous Coward | more than 2 years ago | (#37109634)

Go do php work dimwit.

Re:nice, but still missing... (1)

0123456 (636235) | more than 2 years ago | (#37109636)

If you can't be bothered/figure out how to free memory when you're done with it do the rest of us all a favor and stop programming.

Indeed. Garbage collection solves a few problems by creating a huge pile of new ones, like objects staying around when you thought they'd gone because someone somewhere still has a reference to them, or randomly disappearing because you forgot to keep a reference to them.

Re:nice, but still missing... (2)

Canazza (1428553) | more than 2 years ago | (#37109740)

What is it with lazy/shitty programmers and superfluous references?
If you can't be bothered/figure out how to keep track of your objects do the rest of us all a favor and stop programming.

Re:nice, but still missing... (1)

mangu (126918) | more than 2 years ago | (#37110150)

If you are able to reliably track your objects then why do you need garbage collection at all? If you are so sure you won't need that object from that point forward, why don't you insert a free() or delete instruction at that point?

Re:nice, but still missing... (1)

wsxyz (543068) | more than 2 years ago | (#37109786)

And if you "forget" to keep a reference to your objects when you don't have garbage collection, what happens then?

Re:nice, but still missing... (1)

Bengie (1121981) | more than 2 years ago | (#37109826)

"or randomly disappearing because you forgot to keep a reference to them"
Really? That's an example why GC is bad? I think losing track of your data is poor programming, no matter which language you use.

"creating a heap of new ones" fixed by adding pun

But really, memory leaks with a GC is much easier to debug. There's very few corner cases to "leak" with a managed language.

Re:nice, but still missing... (1)

Anonymous Coward | more than 2 years ago | (#37109758)

If you can't be bothered/figure out how to free memory when you're done with it do the rest of us all a favor and stop programming.

But then who would work on firefox? /joke

Re:nice, but still missing... (1)

superwiz (655733) | more than 2 years ago | (#37109830)

It's not about laziness. It's about dealing with unpredictability. Most modern C++ programs have to deal asynchronous entry into destructors. Mostly due to uncaught exceptions being thrown from multiple threads. If you don't use some automated mechanism for dealing with it, half your code would be dedicated to it. Not taking care of things which can be done machines is a sign of a good programmer. Oh, and programmers who aren't lazy are bad. In fact, very bad.

Re:nice, but still missing... (0)

Anonymous Coward | more than 2 years ago | (#37109652)

Proposals for garbage collection in C++ were for conservative (as opposed to precise) garbage collector.

Re:nice, but still missing... (3, Insightful)

elrous0 (869638) | more than 2 years ago | (#37109710)

You lazy, spoiled punks with your Java and C# garbage collection. Back in my day, we collected our OWN garbage. It was a miserable task, but we were ignorant and didn't know any better. AND WE LIKED IT!

Re:nice, but still missing... (1, Insightful)

Anonymous Coward | more than 2 years ago | (#37109992)

Actually, people did garbage collection themselves because the horrendous waste of resources to have a separate thread, that knows little to nothing about what you're using your resources for, trying to manage them is outright fucking stupid.

Then computers got fast enough that you could write entire applications in interpreted languages running inside of other programs that are bloated and slow (and buggy!) in and of themselves. At that point all of the "programmers" decided that it was okay to write shit code because an inefficient watcher thread could babysit their code without any serious impact to the system (unless god forbid it has an error and crashes).

I'm pretty sure that's what you meant, right?

Re:nice, but still missing... (0)

Anonymous Coward | more than 2 years ago | (#37109738)

...allowing libraries to implement complex memory handling such as garbage collection or persistence...

What's stopping you from writing custom allocators?

- T

Re:nice, but still missing... (4, Informative)

NumLuck (1632865) | more than 2 years ago | (#37109922)

- precise garbage collection (not that I'm missing it)

What is the matter with everyone wanting a garbage collector? Personally, I find smart pointers to be far superior to garbage collection and the new standard now incorporates them in the STL (strongly influenced by BOOST)! With them, the sole idea of garbage collection in C++ is somewhat useless and obsolete.

Re:nice, but still missing... (0)

Anonymous Coward | more than 2 years ago | (#37110152)

When you use smart pointers, you are implementing a reference-counting garbage collector yourself, inefficiently, across your entire codebase.

Reference-counting garbage collectors were state of the art in the Carter administration. The science has advanced since then.

Also, if smart pointers are so awesome, why doesn't operator new() return one?

I'm just disappointed... (1)

kervin (64171) | more than 2 years ago | (#37109302)

They didn't call it C++0b

Oh and didn't include garbage-collection outright ( though they did design it with gc in mind ).

C++ already has something better than GC (1)

Anonymous Coward | more than 2 years ago | (#37109594)

RAII and reference-counting.
I prefer using a program that doesn't periodically stop responding for several seconds, and shove all my other programs into swap, while it re-builds its heap.

oh hell... (2, Funny)

Anonymous Coward | more than 2 years ago | (#37109304)

...the 11th plague of Egypt has arrived a little bit late.

C++0x (1)

BasilBrush (643681) | more than 2 years ago | (#37109308)

How do you pronounce that? It's like they want to advertise that this is a baroque language.

Re:C++0x (0)

Anonymous Coward | more than 2 years ago | (#37109486)

At last, kids--a cheap excuse for saying "cocks" and not getting called down for it.

Re:C++0x (1)

Anonymous Coward | more than 2 years ago | (#37109496)

It's pretty easy to pronounce after you realize that the plus signs are silent.

Re:C++0x (0)

Anonymous Coward | more than 2 years ago | (#37109544)

I believe it's supposed to be pronounced "C++ Oh Ex".

Having said that, I like to say "C++ Hex", since 0x is the standard hexidecimal prefix in C++, and it also gives the language name a certain mystical, not to mention slightly evil, quality.

Re:C++0x (0)

Anonymous Coward | more than 2 years ago | (#37109624)

see plus plus oh ex?

Sadly, tragedy struck (3, Insightful)

AdmiralXyz (1378985) | more than 2 years ago | (#37109324)

As the inaugural copy of the reference manual for the new standard was being printed and bound, it underwent gravitational collapse due to its enormous mass and became a black hole, killing all the committee members. Stroustrup was quoted as saying that despite the misfortune, he still has confidence that the C++0x standard will help programmers be more productive and efficient.

and WOOSH there goes my karma...

Re:Sadly, tragedy struck (1)

bonch (38532) | more than 2 years ago | (#37109824)

and WOOSH there goes my karma...

No, that was the sound of the reverse psychology ploy. Declarations of doomed karma give karma!

2 more years.... (1)

gabereiser (1662967) | more than 2 years ago | (#37109336)

...before compilers support it :( It would have been nice to see even a rudimentary garbage collection included but alas... C++ programmers are the most stubborn...

Re:2 more years.... (1)

Anonymous Coward | more than 2 years ago | (#37109638)

You have RAII. You have smart pointers. Why would you need garbage collection? Only in very exceptional cases I think. The problem seems to be Java-Programmers who don't understand the concept of RAII.

Re:2 more years.... (0)

SplashMyBandit (1543257) | more than 2 years ago | (#37110060)

The real problem is C++ programmers who don't understand the need to clean up heap-allocated memory in an asynchronous multi-threaded environment (who 'owns' the memory is a problem that can break both RAII and if the developer forgets to use a smart pointer somewhere [or uses a library that didn't use one] then you'll have problems - with garbage collection it is less of an issue and new garbage collectors like G1 are very efficient compared to the old days).

Random links? (1)

drb226 (1938360) | more than 2 years ago | (#37109338)

What's with the random links in TFS? Specifically, why link to c2.com for "type inference" and intel.com for "lambda functions"? Wikipedia wasn't good enough for those?

Re:Random links? (1)

smellotron (1039250) | more than 2 years ago | (#37109640)

pecifically, why link to c2.com for "type inference" and intel.com for "lambda functions"? Wikipedia wasn't good enough for those?

Have you ever browsed around c2.com? It's great. Wikipedia is good as a generic "fail-safe" resource, but I'd rather see a deep subject-matter wiki being cited where appropriate.

I imagine the Intel article was referenced due to its examples of syntax. It's more specific than a general encyclopedia entry on lambda functions.

According to google... (0)

Anonymous Coward | more than 2 years ago | (#37109394)

The blog title "C++11 considered harmful" is still up for grabs.

Speaking of obnoxious (1)

drobety (2429764) | more than 2 years ago | (#37109642)

make refactoring code a bit less obnoxious.

Speaking of obnoxious, what's with the 'C++0x' name?

Re:Speaking of obnoxious (1)

Brannoncyll (894648) | more than 2 years ago | (#37109694)

I believe it is because they intended to finalise the standard within the first decade of this millennium rather than the second.

Re:Speaking of obnoxious (4, Informative)

TheRaven64 (641858) | more than 2 years ago | (#37110074)

The x is a placeholder. C99 was C9x before it was standardised. The two digits specify the year (See: C89, Fortran77, and so on) in which the standard is finalised. This is the version of the standard that will be finalised some time between '00 and '09. In common with all other C++ projects, this one was completed late.

Nice, but maybe irrelevant. (4, Interesting)

Animats (122034) | more than 2 years ago | (#37109644)

It's nice that they finally got the standard done. But there's so much junk in there. The C++ committee was dominated by people who wanted to do cool things with templates.

Some years ago, someone figured out that it was possible to abuse the C++ template system into doing arbitrary computations at compile time. This developed a fan club. That fan club has dominated the C++ standards committee, because nobody else cared. So now we have a standard for C++ which supports template-based programming a little better.

Current thinking seems to be that,while template programming is too hard for ordinary programmers, the templates will be written by l33t programmers and then be used by the lower classes. Unfortunately, if anything goes wrong, the end user has to look at the innards of the template to find the problem. We went through this with LISP decades ago. Check out the MIT Loop Macro [cmu.edu] , That finally became stable about the time LISP died out.

Note what isn't in the new C++. There's no more memory safety than in the old one. (Fans will say that it's safer if you only use the new features. Now try to call some library that doesn't use them.) So the buffer overflow attacks and crashes will continue.

C++ is the only language to offer hiding without memory safety. Hard-compiled languages from Pascal through Go have hiding with safety, as do all the major scripting languages. C has neither hiding nor safety; the pointer manipulations are right there in the source. There have been safe, hard-compiled languages without garbage collection, most notably Ada and the Modula family. Safety and speed are not incompatible.

Re:Nice, but maybe irrelevant. (0)

Anonymous Coward | more than 2 years ago | (#37109850)

(Fans will say that it's safer if you only use the new features. Now try to call some library that doesn't use them.)

So you'd prefer if the language somehow magically converts all existing libraries to the safe style of coding?

Re:Nice, but maybe irrelevant. (1)

Kevin Stevens (227724) | more than 2 years ago | (#37110096)

I think you hit the problems with templates nicely. While they were sitting around arguing over concepts, they could have been including support for multithreading. The new move semantics are nice, as are "official" smart pointers, though I am kind of cringing thinking about how much of a pain dealing with incompatibilities with boost smart pointers or other smart pointer libraries might be.

With the exclusion of concepts, the latest standard just moves C++ farther into an experts-only language. The whole standardization process is just too cumbersome. Its just hard to understand how the committee can ignore multithreading, while adding things like lambdas and type inferencing.

Re:Nice, but maybe irrelevant. (1)

tibit (1762298) | more than 2 years ago | (#37110126)

The loop macro is, in essence, part of the compiler or the standard library. It is code that processes code during compilation. I'm not surprised that it's nontrivial.

8 years! (1)

aglider (2435074) | more than 2 years ago | (#37109650)

It took that long for a standard update.

Having a nee standard every few years is not good, that's clear.
But spending 8 years to refine/define one sounds quite a lot in the 21st century.

At least it's in no trouble of dying... (0)

Talonius (97106) | more than 2 years ago | (#37109658)

...unlike C# which Microsoft seems to enjoy having confusion surround (see the HTML/JavaScript fiasco) or Java, which Oracle seems intent on bringing confusion, branding, and licensing to, C++ has managed to evolve for how many years now? Under a committee of people no less?

Say what you will but I've recently decided to go back to my roots and work in C and C++ just for that reason -- there's never a loud outcry that the languages will die a horrible death or go anywhere. In a world of uncertainties I'm tired of having to wonder what language I'll need to master next.

Re:At least it's in no trouble of dying... (1)

Gadget_Guy (627405) | more than 2 years ago | (#37110002)

...unlike C# which Microsoft seems to enjoy having confusion surround (see the HTML/JavaScript fiasco)

It is not confusing. Microsoft used HTML/Javascript for Active Desktop. They used HTML/Javascript for Windows Explorer folder views. They used HTML/Javascript for Windows Sidebar. And they will use HTML/Javascript for the tile interface of Windows 8. It doesn't mean that .NET will disappear, just like .NET did not spell the demised of the standard Windows API.

or Java, which Oracle seems intent on bringing confusion, branding, and licensing to

It has always had branding and licensing, long before Oracle came on the scene. Look at how they went after Microsoft for license and trademark violations.

C++ has managed to evolve for how many years now?

But have they managed to actually implement the features that people want? I have just been reading up on the changes to this new version, and a lot of it seems to be fixing things problems that only exist because of stuff ups in the last version. Java and .NET offer much more than C++, and do it with cleaner code. Sure operator overloading might make some mathematical classes cleaner in C++, but the horrible template interface makes your code appear like it being seen through a haze of line noise.

I can't wait... (0)

Anonymous Coward | more than 2 years ago | (#37109672)

...for the nect version called C++0xck!!!!

Nested Functions (0)

Anonymous Coward | more than 2 years ago | (#37109678)

Anyone know if they added nested functions? It's the thing I miss the most when I'm using C or C++ on multiple platforms.

Re:Nested Functions (0)

Anonymous Coward | more than 2 years ago | (#37109924)

Why would they do that, when you easily work around the issue by using lambda functions:

int fun(int a, int b) {
    auto nested = [&](int x){
        int y = b*x;
        b += x;
        return y;
    };
    return nested(a)+nested(a+1);
}

fuc4er (-1)

Anonymous Coward | more than 2 years ago | (#37109706)

faster, cheapger, with THOUSANDS of Goodbye...she had

Hell continues to get colder (5, Funny)

Anonymous Coward | more than 2 years ago | (#37109744)

First DNF, then a HURD kernel, now C++0x... Remind me to send some parkas to hell.

Super work!!! (0)

Anonymous Coward | more than 2 years ago | (#37109844)

Great job, folks!!!!! :-)

Although everyone didn't get what they wanted, overall the new standard is very, very impressive! The new features open up
whole ecosystems of ideas and will allow for amazing engineering of elegant next-generation software in the real world!

Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

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

Submission Text Formatting Tips

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

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

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

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...