DOCS/contribute: stop pretending that C11 isn't allowed

Doesn't really make much of a different in practice aside from us
dropping ancient legacy fallbacks but still.
This commit is contained in:
Dudemanguy 2023-10-20 17:32:31 -05:00
parent 57fedcfcda
commit 9ea9279cf4
1 changed files with 7 additions and 6 deletions

View File

@ -140,7 +140,7 @@ Touching user-visible parts may require updating the mpv docs
Code formatting
---------------
mpv uses C99 with K&R formatting, with some exceptions.
mpv uses C11 with K&R formatting, with some exceptions.
- Use the K&R indent style.
- Use 4 spaces of indentation, never use tabs (except in Makefiles).
@ -224,15 +224,16 @@ New code must follow the following conventions:
General coding
--------------
- Use C99. Also freely make use of C99 features if it's appropriate, such as
stdbool.h. (Except VLA and complex number types.)
- Use C11. Also freely make use of C11 features if it's appropriate, but do not
use VLA and complex number types.
- Don't use non-standard language (such as GNU C-only features). In some cases
they may be warranted, if they are optional (such as attributes enabling
printf-like format string checks). "#pragma once" is allowed as an exception.
But in general, standard C99 must be used.
But in general, standard C11 must be used.
- The same applies to libc functions. We have to be Windows-compatible too. Use
functions guaranteed by C99 or POSIX only, unless your use is guarded by a
configure check. There is some restricted use of C11 (ask on IRC for details).
functions guaranteed by C11 or POSIX only, unless your use is guarded by a
configure check. Be mindful of MinGW-specifics since C11 support is not always
guaranteed.
- Prefer fusing declaration and initialization, rather than putting declarations
on the top of a block. Obvious data flow is more important than avoiding
mixing declarations and statements, which is just a C90 artifact.