Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2003-12-04 01:54:12

On 12/3/03 10:27 AM, "Douglas Paul Gregor" <gregod_at_[hidden]> wrote:

> [...] Arrays don't play nice with the standard
> library, and frankly I refuse to use them anywhere in application-level
> code unless forced. TR1 has a real array class template, and it's my hope
> that it will someday obsolete built-in arrays for the majority of
> programmers. I've seen the mental mess built-in arrays cause for students:
> "You mean, everything passed by value makes a copy, but arrays passed by
> value is a reference? What do you mean it 'degrades' to a pointer---it
> looks like an array!" Not to mention the inability to add bounds checking,
> which any TR1 implementation could trivially add in debug mode and save us
> lowly TAs lots of time when helping students debug...

Arrays and pointers are separate computer science concepts. Bad decisions
(by K&R ?) about making arrays half-@$$ types and giving pointers some array
powers and array/pointer chumminess have given arrays a bad reputation.
Didn't structures have some of the same restrictions as arrays in early C
(no direct use as function parameters or return types, no assignment)?
Structures were fixed, so why not arrays?

> So basically... I'd rather not add anything that encourages people to use
> built-in arrays, especially now that we've given them a better option.

How about making arrays full-blown types instead, so people don't have to go
for (high-level) object overkill for a basic concept.

Daryle Walker (the [Hopeful] Array-reformer)
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

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