webrtc/g3doc/style-guide/h-cc-pairs.md
Artem Titov a617867a45 Reland "Migrate WebRTC documentation to new renderer"
This reverts commit 0f2ce5cc1c.

Reason for revert: Downstream infrastructure should be ready now

Original change's description:
> Revert "Migrate WebRTC documentation to new renderer"
>
> This reverts commit 3eceaf4669.
>
> Reason for revert:
>
> Original change's description:
> > Migrate WebRTC documentation to new renderer
> >
> > Bug: b/258408932
> > Change-Id: Ib96f39fe0c3912f9746bcc09d079097a145d6115
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290987
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Artem Titov <titovartem@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#39205}
>
> Bug: b/258408932
> Change-Id: I16cb4088bee3fc15c2bb88bd692c592b3a7db9fe
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291560
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Artem Titov <titovartem@webrtc.org>
> Commit-Queue: Artem Titov <titovartem@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#39209}

Bug: b/258408932
Change-Id: Ia172e4a6ad1cc7953b48eed08776e9d1e44eb074
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291660
Owners-Override: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39231}
2023-01-31 09:30:04 +00:00

1.2 KiB

.h and .cc files come in pairs

This is an overflow page for this style rule.

Example violations

Example violations, which should be avoided in new code:

  • Declarations in path/to/include/foo.h, definitions in path/to/source/foo.cc. Fix: The .h and .cc files should be in the same directory.
  • Declarations in foo.h, definitions in both foo_bar.cc and foo_baz.cc. Fix: The .h and .cc files should come in pairs, so either split foo.h into foo_bar.h and foo_baz.h, or merge foo_bar.cc and foo_baz.cc into foo.cc.

Exception for platform-specific code

If the functions in a header file need different implementations for different platforms, we allow the following arrangement:

  • Declarations in foo.h.
  • A complete set of matching definitions in foo_win.cc, another complete set of matching definitions in foo_mac.cc, and so on.
  • As per the main rule, these files should all be in the same directory and in the same build target. The build target should use platform conditionals to ensure that exactly one of the .cc files are included.