From 1e38eb8ae732545f3c87b1a93213129685e65a3c Mon Sep 17 00:00:00 2001 From: Bjarne Stroustrup Date: Sat, 22 Apr 2017 18:10:58 -0400 Subject: [PATCH] ban longjmp --- CppCoreGuidelines.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 88d75e9..a72c7e6 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -1,6 +1,6 @@ # C++ Core Guidelines -April 19, 2017 +April 22, 2017 Editors: @@ -17638,6 +17638,7 @@ Iostream rule summary: * [SL.io.1: Use character-level input only when you have to](#Rio-low) * [SL.io.2: When reading, always consider ill-formed input](#Rio-validate) * [???](#???) +* [SL.io.10: Unless you use `printf`-family functions call `ios_base::sync_with_stdio(false)`](#Rio-sync) * [SL.io.50: Avoid `endl`](#Rio-endl) * [???](#???) @@ -17649,6 +17650,24 @@ Iostream rule summary: ??? +### SL.io.10: Unless you use `printf`-family functions call `ios_base::sync_with_stdio(false)` + +##### Reason + +Synchronizing `iostreams` with `printf-style` I/O can be costly. + +##### Example + + int main() + { + ios_base::sync_with_stdio(false); + // ... use iostreams ... + } + +##### Enforcement + +??? + ### SL.io.50: Avoid `endl` ### Reason @@ -17686,9 +17705,20 @@ the choice between `'\n'` and `endl` is almost completely aesthetic. C standard library rule summary: +* [S.C.1: Don't use setjmp/longjmp](#Rclib-jmp) * [???](#???) * [???](#???) -* [???](#???) + +### SL.C.1: Don't use setjmp/longjmp + +##### Reason + +a `longjmp` ignores destructors, thus invalidating all resource-management strategies relying on RAII + +##### Enforcement + +Flag all occurences of `longjmp`and `setjmp` + # A: Architectural Ideas