I think that you guys should do this.  We've been using C++11 (we use
gcc 4.7, so we get more than you) and it's been very useful.  Funny
thing is, the things that Andreas mentioned are not things that I find
most valuable (except for auto).  Here are some things I find
particularly useful that you will have access to in gcc 4.4.

I think that the biggest deal is rvalue references and std::move.  It
is a little bit mind bending at first, but once you get it, it's not
bad.  Basically, what it add to the language is move semantics.
Sometimes this is implicit (i.e. when the compiler knows that
something is an rvalue) and sometimes this is explicit (when you use
std::move).  Moves basically avoid copies, especially with temporary
variables.  They also power unique_ptr which is really handy.  The
best reference on the subject is probably
http://thbecker.net/articles/rvalue_references/section_01.html you're
interested, but by far the best thing I've found to understand what
rvalue references are is this: an rvalue is something that has no name
(symbol) associated with it.  It generally applies to temporaries, and
when the compiler sees these, it will try to use move semantics before
trying copy semantics.  Perfect forwarding is also handy, though it
doesn't come up pretty often (basically only when you have a template,
so you don't know if you have an rvalue or not).

std::shared_ptr is really nice. It has a virtual destructor, so in the
case where you need a virtual destructor anyway, it's not quite as
fast as ours (probably in the noise though), but the virtual
destructor allows us to avoid the problems we had when deriving from
the RefCounting base class and an allocator (though, I guess we've
dropped FastAlloc).  It also allows you to avoid deriving from
RefCounting, so you can pretty much use it on anything.  The other
cool thing that you get is weak_ptr.  This allows you to hold a
pointer without a reference count in a safe manner (though it messes
with the timing of deallocation, so be careful).

variadic templates.  It basically allows a better implementation of
cprintf/DPRINTF (which I have if you want).  One feature that this
would enable would be an object specific implementation of dprint (the
stuff underlying dprintf).  This would allow you to add conditionals
on a per object basis (so you could track a memory address more easily
for example.)  It's possible to do this without the new version, but
it is more confusing than with the new version.

auto really is super awesome.  I haven't seen the need for decltype yet.

  Nate
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to