Add style guidance about forward declarations.

We prefer the Google style guide over the chromium guide in this case:
avoid forward declarations whenever possible. We don't have the same
compilation time issue that chromium does, so we can afford to do this.

The majority of our code already follows this guideline, as far as I'm
aware, though some forward declarations are still used to resolve
circular dependencies.

Bug: None
Notry: true
Change-Id: I712e0361acf76217067b13b8b3e4bc931d2a0238
Reviewed-on: https://webrtc-review.googlesource.com/8800
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22662}
This commit is contained in:
Taylor Brandstetter
2017-10-12 11:22:48 -07:00
committed by Commit Bot
parent e2971ec2ab
commit 212a20604a

View File

@ -121,6 +121,14 @@ for every occasion. Prefer to use interfaces when that makes sense,
and consider `rtc::FunctionView` for cases where the callee will not
save the function object.
### Forward declarations
WebRTC follows the [Google][goog-forward-declarations] C++ style guide
with respect to forward declarations. In summary: avoid using forward
declarations where possible; just `#include` the headers you need.
[goog-forward-declarations]: https://google.github.io/styleguide/cppguide.html#Forward_Declarations
## **C**
There’s a substantial chunk of legacy C code in WebRTC, and a lot of