From 9ea9279cf4fdfbe529a3146b33aaa51389338b2f Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Fri, 20 Oct 2023 17:32:31 -0500 Subject: [PATCH] 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. --- DOCS/contribute.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/DOCS/contribute.md b/DOCS/contribute.md index c33cab1467..8464ddab8b 100644 --- a/DOCS/contribute.md +++ b/DOCS/contribute.md @@ -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.