Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2006-05-25 10:13:55


 

| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]] On Behalf Of Thorsten Ottosen
| Sent: 25 May 2006 15:02
| To: boost_at_[hidden]
| Subject: Re: [boost] [array] optional constructors in Boost.Array
|
| Vincent Bhérer-Roy wrote:
| > On 25-May-06, at 06:39, Thorsten Ottosen wrote:
|
| > Also, it will gives compile time errors for things like that:
| >
| > array<int,4> a = list_of(1)(2)(3).to_array( a ); // compiles fine
| > array<int,4, true> a(1,2,3); // doesn't compile
|
| Note that the former zero-initializes the remaining elements.

This is exactly what is NOT wanted.

Although zeros are slightly better than a random not-initialised value, it
is far, far better to get a compile time message when clearly one meant to
initialize all the elements.

This is a fundamental mistake in C philosophy IMO.

It you want an array un-initialized, one should have say so very
specifically.

Otherwise, failure to initialize all the array is a mistake.

(other languages have convenient syntax for repeat counts, but that another
step).

Paul

---
Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539561830 & SMS, Mobile +44 7714 330204 & SMS
pbristow_at_[hidden]
 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk