Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2005-06-06 11:18:38


 

| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]] On Behalf Of Dave Harris
| Sent: 05 June 2005 15:18
| To: boost_at_[hidden]
| Subject: Re: [boost] Re: Re: Boost Array Initialization Technique
|
| In-Reply-To: <d7iigr$7tn$1_at_[hidden]>
| technews_at_[hidden] (Jonathan Turkanis) wrote (abridged):
| > boost::array is just supposed to give built-in arrays a container
| > interface. Built-in arrays never have size 0, so I don't see
| > why boost::arrays should.
|
| Surely built-in arrays can have size 0? For example:
|
| int n = 0;
| int *array = new int[n];
|
| In my experience it is important to handle zero edge-cases
| correctly and
| uniformly. I have been reading:
| http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1479.html
|
| and I don't understand the reasoning there. Personally I'd
| rather change
| the language so that:
|
| const int n = 0;
| int array[n];
|
| was acceptable too, making the static case consistent with
| the dynamic
| case and both consistent with n>0.

I agree with this strongly.

And the best way to deal with default initialisation is to remove it
completely.

A recent 'quiz' of the UK BSI C++ panel reveal that it is so confusing that
even above averagely 'experts' often get it wrong - or fail to agree what
the right answer is!)

This is a big language change, but a vital one IMO.

Paul

Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539 561830 +44 7714 330204
mailto: 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