tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

h-cc-pairs.md (1240B)


<!-- go/cmark --> <!--* freshness: {owner: 'danilchap' reviewed: '2025-09-24'} *-->

`.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:

path/to/source/foo.cc. Fix: The .h and .cc files should be in the same directory.

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:

complete set of matching definitions in foo_mac.cc, and so on.

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.