From 6e72adc0fe8750aa635fa1c6def9e71d19850a7b Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Thu, 30 Jan 2020 11:28:19 -0800 Subject: [PATCH] Casting away const isn't undefined behavior, but modifying a constant is (#1509) * Casting away const isn't undefined behavior, but modifying a constant is You can cast away `const` as much as you like, as long as you never write to variable. * rewording for clarification --- CppCoreGuidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index e61a3d3..1260718 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -11780,7 +11780,7 @@ for example.) ##### Reason It makes a lie out of `const`. -If the variable is actually declared `const`, the result of "casting away `const`" is undefined behavior. +If the variable is actually declared `const`, modifying it results in undefined behavior. ##### Example, bad