This page describes our coding conventions.
Platform Specific Code
Platform specific code should use the predominant coding convention
for that platform. Basically, DirectShow code should look familar to a
Windows coder, and QuickTime code should look familiar to an Apple
coder. Otherwise, we follow the conventions described here.
Our whitespace rules are defined by the following astyle transform:
astyle --style=bsd --min-conditional-indent=0 --break-blocks --pad-oper --pad-header --unpad-paren --align-pointer=name --indent-preprocessor --indent-labels "$@"
This boils down to:
- Don’t use tabs.
- Braces on their own line
- Spaces around operators (
|, etc.) and
after control statements (
- Most identifiers should be lowercase_delimited
- Macros and enum values should be UPPERCASE_DELIMITED
- Typedefs should be postfixed with
_t, but …
- Prefer to use types directly rather than type.
The code is not always consistent with these conventions, for
historical reasons. These inconsistencies should be resolved, not
propagated. i.e., if you find something that’s named inconsistently,
submit a patch fixing it. Some identifiers conform to these
conventions but are spelled funny (e.g.
de_quantize) as a result of some
automatic transforms. You can submit patches fixing these as well.