C++ Reference

This page is a grab bag of useful links to C++ documentation in the Mozilla source docs or in the source code itself.

This will grow and gain organisation, so please add any links you find useful!

Miscellaneous

  • Using C++ in Mozilla code - general C++ coding guidelines.

  • XPIDL - details for XPCOM IDL files (e.g. how the types map between IDL, C++, Rust and JS).

  • {fmt} in Gecko - An implementation of C++20’s std::format formatting API, with some extra Mozilla goodies.

  • GTests - Unit tests for C++.

Data structures

Utility

  • Result - Analogous to Rust Result<> (examples in GTest).

  • Maybe - Analogous to Rust Option<> or C++ std::optional (examples in GTest).

  • ScopeExit - An RAII guard to automatically handle scoped cleanup.

  • MozPromise - Promises for C++.