Pages: 1 2 3 »
  Print  
Author Topic: c++0x  (Read 6203 times)
Offline (Male) RetroX
Posted on: May 18, 2010, 03:55:06 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I should have looked the standards up ages ago

This is wonderful

idgaf if it doesn't work in VC++, but it works with G++
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) luiscubal
Reply #1 Posted on: May 18, 2010, 04:13:26 PM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
VC++ 2010 has partial support for C++0x(auto, for example)

Main new features:
In vectors, >> is now correctly identified as close template arguments twice as expected(and when not ambiguous);
Code: [Select]
vector<vector<int>>
//vs
vector<vector<int> >

Type inference:
Code: [Select]
for(auto i = vect.begin(); i < vect.end(); ++i)
//vs
for(vector<vector<vector<Xyz>::iterator>::iterator>::iterator i = vect.begin(); i < vect.end(); ++i)

Basic UTF-8/UTF-16/UTF-32 support

Lambda

It has a couple extra stuff, but what I mentioned above is the most noticeable of it.
C++0x was also meant to include something named "concepts", which I'm not quite sure what it means, but it was postponed.
Logged
Offline (Male) RetroX
Reply #2 Posted on: May 18, 2010, 04:20:56 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Basically that, yeah.

It also had a pseudo-foreach:
Code: [Select]
int x[5];
for (int &i : x) { std::cout << x[i] << " "; }

and a pseudo-typeof:
Code: [Select]
int x;
decltype(x) y;
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #3 Posted on: May 18, 2010, 05:35:40 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2960

View Profile Email
GCC's had and whored most of those for a while now.
It's not like template<> wasn't already ambiguous in some cases.
Fortunately, I believe lambda is the only exception to this not being a problem. I believe they introduced a couple more syntax quirks that I was going to add to ENIGMA anyway... I imagine it will all blow over well.
They've had typeof for a while. __typeof, it was. I just defined it as int for ENIGMA, because expression types don't really matter to my parser, as they are all just abstract names to it. I may need to fix that as they start pulling shit like typeof(something awful) :: some_member... Hopefully that never really happens, or by the time it does, a project I've had my eye on that can tell GCC to export XML reaches fruition.
Or becomes unnecessary as GCC decides to implement an alternative, which is even less likely.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #4 Posted on: May 18, 2010, 06:21:15 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I had to include it along with cstdint, so, I just got into the habit of including -std=c++0x on compile.  I never looked into it, though. :/
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #5 Posted on: May 18, 2010, 06:45:54 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
C++0x is "let's take this really complicated language with lots of weird details and add more weird details along with any possible good ideas we can mangle." Seriously, "decltype" and "nullptr" as keywords? Ah well, they can't do too much more damage and we get closures!
Logged
Offline (Male) RetroX
Reply #6 Posted on: May 18, 2010, 06:58:39 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
That is, implying that C++ is an incredibly complicated language.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #7 Posted on: May 18, 2010, 07:26:50 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
Which it is, unless you're blind.
Logged
Offline (Male) RetroX
Reply #8 Posted on: May 18, 2010, 07:31:04 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Which it is, unless you're blind.
I seem to have pretty good eye sight, and it looks quite simple to me.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #9 Posted on: May 18, 2010, 07:48:14 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2960

View Profile Email
C++: It is easier when you are blind


:troll:
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Rusky
Reply #10 Posted on: May 18, 2010, 08:03:30 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
You don't need to understand all of C++ to use it, which is why it's usable. But the whole thing is far more complicated than most other languages. I'm not saying C++ is needlessly complicated, just that it's complicated.

Compare the K&R book to Stroustrup's C++ book. The C++ one is several times longer. Look at C++ FAQ Lite- with that many non-trivial language questions, there's obviously some complication going on. References v pointers, virtual destructors, the comma operator (O_o), bla bla bla. Then look at some of the things the C++0x committee feels (or felt) are necessary- rvalue references, "uniform" initialization, new return type syntax, the delete keyword and concepts/axioms.

It's complicated.
Logged
Offline (Male) RetroX
Reply #11 Posted on: May 18, 2010, 08:14:41 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
POINTING to MEMORY!?!?!?

I don't get it.


Yes, there's a few *somewhat* complicated things in C++, but it's not nearly as bad as you make it out to be.  It's not that hard to learn.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) Micah
Reply #12 Posted on: May 19, 2010, 08:48:52 AM

Resident Troll
Joined: May 2008
Posts: 129

View Profile
In comparison with Lisp, or Ruby, or Python, or Lua, or Go, or many other languages, yes, it is that hard to learn.
Logged
Offline (Unknown gender) luiscubal
Reply #13 Posted on: May 19, 2010, 10:02:03 AM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
Complication means that any "half-decent" C++ specification is several hundreds(thousands?) pages long.
You don't know C++. You know a very small subset of C++. For instance, digraphs and trigraphs. Are those trivial? No. They may be simple, but they are an unusual detail of the language.
Don't say they are useless and nobody uses them. That's kind of the point. C++ includes lots of useless things(which might have been useful some time in the past) nobody uses anymore.
Compare C++ to Java. You may hate Java, you may hate garbage collection, but if you were to compare a complete C++ language spec with a complete Java language spec, you'd see Java spec is smaller.

Also, in defense of nullptr, the problem is:

Code: [Select]
void f(int x);
void f(void* x);

...
f(NULL); //Will call f(int)
f(nullptr); //Will call f(void*)
« Last Edit: May 19, 2010, 10:05:02 AM by luiscubal » Logged
Offline (Male) Rusky
Reply #14 Posted on: May 19, 2010, 12:26:02 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
Retro: References and pointers. Two ways to point to memory. Yes, they're both useful. No, they're not simple. Learning to use C++ isn't that hard, I agree. But understanding all of its little details so you never run into weird situations is extremely difficult.

luiscubal: NULL should never have existed that way in the first place, and it's all caps. nullptr could easily be null without causing problems with NULL. It's stupid to call it nullptr no matter how it came to be that way. Besides, that's the point.
Logged
Pages: 1 2 3 »
  Print