 |
STL Container .size()
Submitted by |

The following code is potentially dangerous because size() returns an
unsigned type:
std::vector<Object v;
for(int i = 0; i < v.size() - 1; i++) ; |
Try this:
std::vector<Object v;
for(int i = 0; i < int(v.size()) - 1; i++) ; |
Overflow shouldn't be a problem - unless your objects are very small, you're
likely to run out of address space before you run out of int :)
Andrew,
a_j_harvey@hotmail.com
|
The zip file viewer built into the Developer Toolbox made use
of the zlib library, as well as the zlibdll source additions.
|