Suppressing loads of GCC warning about automatic typecasting ambiguity

This commit is contained in:
natureh 2012-02-26 01:05:57 +01:00
parent d5cc52771b
commit c21fa69aea
2 changed files with 7 additions and 7 deletions

View File

@ -156,7 +156,7 @@ public:
} }
// use with indices // use with indices
T * operator[](size_t index) { T * operator[](int index) {
assert(index<y); assert(index<y);
return ptr[index]; return ptr[index];
} }
@ -252,7 +252,7 @@ private:
public: public:
multi_array2D(int x, int y, int flags = 0) { multi_array2D(int x, int y, int flags = 0) {
for (int i = 0; i < num; i++) for (size_t i = 0; i < num; i++)
list[i](x, y, flags); list[i](x, y, flags);
} }
@ -260,9 +260,9 @@ public:
//printf("trying to delete the list of array2D objects\n"); //printf("trying to delete the list of array2D objects\n");
} }
array2D<T> & operator[](size_t index) { array2D<T> & operator[](int index) {
if (index >= num) { if (static_cast<size_t>(index) >= num) {
printf("index %zu is out of range[0..%zu]", index, num - 1); printf("index %0u is out of range[0..%0u]", index, num - 1);
raise( SIGSEGV); raise( SIGSEGV);
} }
return list[index]; return list[index];