


|
 |
| << Topic |
< Post |
Post 4 of 4 Topic 4109 of 4400
|
Post > |
Topic >> |
Re: Lesson 5, Arrays, Static, Dynamic, Multi Dimesional.
by "Alf P. Steinbach" <alfps@[EMAIL PROTECTED]
>
Apr 14, 2008 at 06:16 PM
| * Hal Vaughan:
> Alf P. Steinbach wrote:
>
>> * TheDevil:
>>> [raw] Arrays in C/C++ ... can lead to hard to find bugs pretty easily.
>> Yes, that's right.
>>
>> As a novice, preferentially use std::vector, and use 'at(i)' rather
than
>> '[i]'.
>
> Why use at(i) over [i]?
Because it reacts to indexing errors by throwing an exception, instead of
silently producing an incorrect result or tra****ng some memory area.
In other words, it provides guaranteed bounds-checking.
So it's much easier to detect those nefarious bugs.
Cheers, & hth.,
- Alf


|
4 Posts in Topic:
|
"TheDevil" < |
2008-04-13 01:52:31 |
|
"Alf P. Steinbach&qu |
2008-04-13 02:34:14 |
|
Hal Vaughan <hal@[EMAI |
2008-04-14 15:36:55 |
|
"Alf P. Steinbach&qu |
2008-04-14 18:16:19 |
|
Post A Reply:

|
|
|
|