C++0x

Pages: 12
closed account (S6k9GNh0)
I figured I would review the C++0x and document it while I'm at it for a few reasons. To start off, let's go for my favorite, the range-based for-loop.

http://en.wikipedia.org/wiki/C%2B%2B0x#Range-based_for-loop

EDIT: fudge, gotta go, bbl.
Wow... just... wow...

This version of C++ is gonna rock.

-Albatross
I just installed gcc 4.5 which supports many of the C++0x features and it's really cool
Unfortunately the new for is not yet supported
But Boost's foreach does that though... Here's the Wikipedia code using Boost:
1
2
#include <boost/foreach.hpp>
#define foreach BOOST_FOREACH 
1
2
3
4
5
int my_array[5] = {1, 2, 3, 4, 5};
foreach (int& x, my_array)
{
  x *= 2;
}

Enjoy!
the same syntax of loop in java..

i don't like the name 0x
0x was a temporary name gave because it was thought to be released before 2010, it's not official
how about C+=2 lol
closed account (1yR4jE8b)
The OpenSuse development branch just switch over to GCC 4.5 so I'm going to wait for 11.3 to try it out...but the new language features are hella exciting.

I really like the idea of the auto keyword.
closed account (S6k9GNh0)
Should I use boost or the new C++ standard?
closed account (1yR4jE8b)
You should be using boost anyway ;-D It's farking amazing
The new C++ standard is not yet a standard
closed account (S6k9GNh0)
That sentence conflicts itself. That also means that you probably know what I actually meant. >.>
the standard is not standard?
It must go a year without major edits before ANSI will adopt it as "standard".
Therefore, no, what people commonly refer to as the "C++0x standard" is
really just a proposal at this point.
Although basically all compiler vendors are incorporating features anyway (good!).
What would really suck is if for some reason ANSI suddenly changed everything about the standard, a few hours before they adopted it as the standard.

They'd never do that, but...

-Albatross
closed account (1yR4jE8b)
Then it couldn't be adopted...it has to be unchanged for an entire year before it becomes standard. That's the process.
I know, I know...

Still, Intel and the GNU Project and Microsoft would be completely pissed.

However, I do seriously hope that the standard remains unchanged for that year. I can't think of anything really critical that C++ needs that isn't in the new non-standard standard, and we really need those things that are in the standard.

EDIT: Maybe not need, but it would save us a lot of coding time.

-Albatross
Last edited on
There are a LOT of good features that will not be included in the next standard.
I hope that the following language update will come sooner than this had.
Pages: 12