|
|
|
|
@ -680,11 +680,13 @@ You don't need to write error handlers for errors caught at compile time.
|
|
|
|
|
if (bits < 32)
|
|
|
|
|
cerr << "Int too small\n"
|
|
|
|
|
|
|
|
|
|
This example is easily simplified
|
|
|
|
|
This example fails to achieve what it is trying to achieve (because overflow is undefined) and should be replaced with a simple `static_assert`:
|
|
|
|
|
|
|
|
|
|
// Int is an alias used for integers
|
|
|
|
|
static_assert(sizeof(Int) >= 4); // do: compile-time check
|
|
|
|
|
|
|
|
|
|
Or better still just use the type system and replace `Int` with `int32_t`.
|
|
|
|
|
|
|
|
|
|
##### Example
|
|
|
|
|
|
|
|
|
|
void read(int* p, int n); // read max n integers into *p
|
|
|
|
|
|