If I were to compile this function with -DNDEBUG, I'd get a compiler warning about 'control reaches the end of a non-void function'. It seems ugly to shove a 'return arbitrary_value;' after the assert. Is there Another Way?
int const store[] = { 1, 2, 3, 4, 5 };
int const store_size = sizeof(store) / sizeof(store[0]);
int find(int value) {
for (int i = 0; i < store_size; ++i) {
if (store[i] == value)
return i;
}
assert(0);
}
--
Angus
