Add example for E.28 (#1385)

This commit is contained in:
Amir Livneh
2019-03-21 14:06:02 -04:00
committed by Herb Sutter
parent c2a5785d7e
commit e3da8a1fd9

View File

@@ -16079,7 +16079,15 @@ When did you last test the return value of `printf()`?
##### Example, bad ##### Example, bad
??? int last_err;
void f(int n)
{
// ...
p = static_cast<X*>(malloc(n * sizeof(X)));
if (!p) last_err = -1; // error if memory is exhausted
// ...
}
##### Note ##### Note