diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index ce15556..b34a690 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -5681,7 +5681,7 @@ Consider: The result of `pb2=="D"` is actually implementation defined. We added it to warn of the dangers of home-brew RTTI. -This code may work as expected for years, just to fail on a new machine or new compiler that does not unify character literals. +This code may work as expected for years, just to fail on a new machine, new compiler, or a new linker that does not unify character literals. If you implement your own RTTI, be careful. @@ -5693,6 +5693,10 @@ You will basically be crafting your own special-purpose `dynamic_cast`. So, first make sure that your `dynamic_cast` really is as slow as you think it is (there are a fair number of unsupported rumors about) and that your use of `dynamic_cast` is really performance critical. +We are of the opinion that current implementations of `dynamic_cast` are unnecessarily slow. +For example, under sutitable conditions, it is possible to perform a `dynamic_cast` in [fast constant time](http://www.stroustrup.com/fast_dynamic_casting.pdf). +However, compatibility makes changes difficult even if all agree that an effort to optimize is worth while. + ##### Enforcement Flag all uses of `static_cast` for downcasts, including C-style casts that perform a `static_cast`.