|
![](/i/fill.gif) |
Le 04/03/2012 23:33, Warp nous fit lire :
> In C++ in particular this is another situation were the majority of C++
> programmers out there have no idea what's wrong:
* you used a template ? (nop, just a red herring for you! but a single
uppercase letter is usually preferred to Value_t)
* you have the [] checks the upper range (whereas usually it's at()
which check, and [] do not)
* you checked upper range, but not lower one
* you should have stated index in [] with const
* using assert is not the right way to handle the issue.
* you did not test in creator the value of size ( 0 ?)
* copy-constructor... you're in trouble with mData
* you did not disable automatic conversion of "number" into Array<>, so
if you have some different signature for some methods using either
number or Array<>, you're in for surprise (explicit)
With actual compiler:
* you forget the include needed for size_t (cstring)
* you forget the declaration of assert() (assert.h)
Post a reply to this message
|
![](/i/fill.gif) |