Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2002-03-11 09:49:01

> -----Original Message-----
> From: rwgk [mailto:rwgk_at_[hidden]]
> Sent: Friday, March 08, 2002 7:07 PM
> To: boost_at_[hidden]
> Subject: [boost] Re: container design (Was: std::complex design (Was:
> N-Dimensional array))
> In my mind
> vector<double> vec(100000, uninitialized_flag());
> means these things:
> 1. I do not want to waste time for something that I am
> absolutely sure I do not need (the default construction)
> because
> 2. I am about to fill the memory with the given number
> of elements by some other facility, and
> 3. I am taking responsibility and I have read the
> documentation for uninitialized_flag() which told me
> to initialize the memory before doing /anything/ else
> with it.
> Being safe by default is great, but IMO forcing everyone to
> waste time only to be safe under any conceivable eventuality
> is misguided and may be one of the reasons why C++ still has
> a bad reputation among many (non-computer) scientists.
> Ralf

Yes - Ralf is absolutely right and is a reason why C++ isn't getting used.

(I think that the original mistake was to give scalars a default value - why
zero? and not to provide a syntax that more strongly encouraged

int x = if (condition) then 1 else 2;)

Andy Keonig's paper only makes it worse when construction is more expensive.

It really is important to solve this somehow, and uninitialized_flag() looks
least worst.


Dr Paul A Bristow, hetp Chromatography
Prizet Farmhouse
Kendal, Cumbria
+44 1539 561830
Mobile +44 7714 33 02 04

Boost list run by bdawes at, gregod at, cpdaniel at, john at