mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Explicitly forbid dynamic_cast
After discussion on webrtc-core, this option is still thought to be a Bad Idea in webrtc. Bug: none Change-Id: I15d0a6f7d6489b8bf37c1dfa31572139c9b85753 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281881 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38555}
This commit is contained in:
parent
dd34a482d9
commit
f88487c5c9
1 changed files with 10 additions and 0 deletions
|
@ -173,6 +173,16 @@ headers you need.
|
|||
|
||||
[goog-forward-declarations]: https://google.github.io/styleguide/cppguide.html#Forward_Declarations
|
||||
|
||||
### RTTI and dynamic_cast
|
||||
|
||||
The Google style guide [permits the use of dynamic_cast](https://google.github.io/styleguide/cppguide.html#Run-Time_Type_Information__RTTI_).
|
||||
|
||||
However, WebRTC does not permit it. WebRTC (and Chrome) is compiled with the
|
||||
-fno-rtti flag, and the overhead of enabling RTTI it is on the order of 220
|
||||
Kbytes (for Android Arm64).
|
||||
|
||||
Use static_cast and take your own steps to ensure type safety.
|
||||
|
||||
## C
|
||||
|
||||
There's a substantial chunk of legacy C code in WebRTC, and a lot of it is old
|
||||
|
|
Loading…
Reference in a new issue