Check array size is not zero after resize
This commit is contained in:
parent
d463c036b1
commit
d02bb84b9f
8
common.h
8
common.h
@ -33,6 +33,14 @@ struct badntimes : public std::exception
|
||||
}
|
||||
};
|
||||
|
||||
struct badarraysize : public std::exception
|
||||
{
|
||||
virtual const char * what () const throw ()
|
||||
{
|
||||
return "Array size must be >= 1024";
|
||||
}
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
void check_solution(void* a_in, void* b_in, void* c_in)
|
||||
{
|
||||
|
||||
@ -81,6 +81,7 @@ int main(int argc, char *argv[])
|
||||
<< "Warning: array size must divide 1024" << std::endl
|
||||
<< "Resizing array from " << OLD_ARRAY_SIZE
|
||||
<< " to " << ARRAY_SIZE << std::endl;
|
||||
if (ARRAY_SIZE == 0) throw badarraysize();
|
||||
}
|
||||
|
||||
// Get precision (used to reset later)
|
||||
|
||||
@ -65,6 +65,7 @@ int main(int argc, char *argv[])
|
||||
<< "Warning: array size must divide 1024" << std::endl
|
||||
<< "Resizing array from " << OLD_ARRAY_SIZE
|
||||
<< " to " << ARRAY_SIZE << std::endl;
|
||||
if (ARRAY_SIZE == 0) throw badarraysize();
|
||||
}
|
||||
|
||||
// Get precision (used to reset later)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user