From: Anton Khirnov <anton@khirnov.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 2/7] doc/developer.texi: move the language feature section higher up Date: Thu, 17 Nov 2022 11:09:37 +0100 Message-ID: <20221117100942.6217-2-anton@khirnov.net> (raw) In-Reply-To: <20221117100942.6217-1-anton@khirnov.net> It makes more sense to first describe the language we are using and only then document how to format code in it, rather than the reverse. --- doc/developer.texi | 104 ++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/doc/developer.texi b/doc/developer.texi index cf918ac6b1..8e6d9d8730 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -56,6 +56,58 @@ and should try to fix issues their commit causes. @anchor{Coding Rules} @chapter Coding Rules +@section C language features + +FFmpeg is programmed in the ISO C90 language with a few additional +features from ISO C99, namely: + +@itemize @bullet +@item +the @samp{inline} keyword; + +@item +@samp{//} comments; + +@item +designated struct initializers (@samp{struct s x = @{ .i = 17 @};}); + +@item +compound literals (@samp{x = (struct s) @{ 17, 23 @};}). + +@item +for loops with variable definition (@samp{for (int i = 0; i < 8; i++)}); + +@item +Variadic macros (@samp{#define ARRAY(nb, ...) (int[nb + 1])@{ nb, __VA_ARGS__ @}}); + +@item +Implementation defined behavior for signed integers is assumed to match the +expected behavior for two's complement. Non representable values in integer +casts are binary truncated. Shift right of signed values uses sign extension. +@end itemize + +These features are supported by all compilers we care about, so we will not +accept patches to remove their use unless they absolutely do not impair +clarity and performance. + +All code must compile with recent versions of GCC and a number of other +currently supported compilers. To ensure compatibility, please do not use +additional C99 features or GCC extensions. Especially watch out for: + +@itemize @bullet +@item +mixing statements and declarations; + +@item +@samp{long long} (use @samp{int64_t} instead); + +@item +@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar; + +@item +GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}). +@end itemize + @section Code formatting conventions There are the following guidelines regarding the indentation in files: @@ -121,58 +173,6 @@ int myfunc(int my_parameter) ... @end example -@section C language features - -FFmpeg is programmed in the ISO C90 language with a few additional -features from ISO C99, namely: - -@itemize @bullet -@item -the @samp{inline} keyword; - -@item -@samp{//} comments; - -@item -designated struct initializers (@samp{struct s x = @{ .i = 17 @};}); - -@item -compound literals (@samp{x = (struct s) @{ 17, 23 @};}). - -@item -for loops with variable definition (@samp{for (int i = 0; i < 8; i++)}); - -@item -Variadic macros (@samp{#define ARRAY(nb, ...) (int[nb + 1])@{ nb, __VA_ARGS__ @}}); - -@item -Implementation defined behavior for signed integers is assumed to match the -expected behavior for two's complement. Non representable values in integer -casts are binary truncated. Shift right of signed values uses sign extension. -@end itemize - -These features are supported by all compilers we care about, so we will not -accept patches to remove their use unless they absolutely do not impair -clarity and performance. - -All code must compile with recent versions of GCC and a number of other -currently supported compilers. To ensure compatibility, please do not use -additional C99 features or GCC extensions. Especially watch out for: - -@itemize @bullet -@item -mixing statements and declarations; - -@item -@samp{long long} (use @samp{int64_t} instead); - -@item -@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar; - -@item -GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}). -@end itemize - @section Naming conventions All names should be composed with underscores (_), not CamelCase. For example, @samp{avfilter_get_video_buffer} is an acceptable function name and -- 2.35.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-11-17 10:10 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-17 10:09 [FFmpeg-devel] [PATCH 1/7] configure: drop support for complex functions Anton Khirnov 2022-11-17 10:09 ` Anton Khirnov [this message] 2022-11-17 10:09 ` [FFmpeg-devel] [PATCH 3/7] doc/developer.texi: update the language feature section Anton Khirnov 2022-11-17 10:09 ` [FFmpeg-devel] [PATCH 4/7] doc/developer.texi: document the use of other languages than C Anton Khirnov 2022-11-17 14:17 ` Lynne 2022-11-17 14:25 ` James Almer 2022-11-17 14:33 ` Lynne 2022-11-19 14:22 ` Anton Khirnov 2022-11-19 14:30 ` Lynne 2022-11-17 10:09 ` [FFmpeg-devel] [PATCH 5/7] doc/developer.texi: move editor configuration under formatting Anton Khirnov 2022-11-17 10:09 ` [FFmpeg-devel] [PATCH 6/7] doc/developer.texi: drop a misplaced sentence from code formatting section Anton Khirnov 2022-11-17 10:09 ` [FFmpeg-devel] [PATCH 7/7] doc/developer.texi: extend and update naming conventions Anton Khirnov 2022-11-17 19:43 ` [FFmpeg-devel] [PATCH 1/7] configure: drop support for complex functions Paul B Mahol
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221117100942.6217-2-anton@khirnov.net \ --to=anton@khirnov.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git