[llvm-commits] CVS: llvm/include/Support/DenseMap.h
Chris Lattner
sabre at nondot.org
Wed Feb 25 23:25:01 PST 2004
On Wed, 25 Feb 2004, Alkis Evlogimenos wrote:
> > Fix a bug in the densemap that was killing the local allocator, and probably
> > other clients. The problem is that the nullVal member was left to the default
> > constructor to initialize, which for int's does nothing (ie, leaves it unspecified).
> >
> > To get a zero value, we must use T(). It's C++ wonderful? :)
>
> Wow... I always thought that all members had T() called if you didn't
> specify it.
Nope. Strange but true:
T v;
and
T v = T();
act differently when T is an int, pointer or other primitive type. I
personally think that this is foolish, as even a dumb compiler can
eliminate default dead initializations of primitives, but the C++ commitee
didn't ask me. :)
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/
More information about the llvm-commits
mailing list