diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index f562b1f..eaa0f18 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -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(malloc(n * sizeof(X))); + if (!p) last_err = -1; // error if memory is exhausted + // ... + } ##### Note