mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
Add example for E.28 (#1385)
This commit is contained in:
@@ -16079,7 +16079,15 @@ When did you last test the return value of `printf()`?
|
||||
|
||||
##### 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user