From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8D17444D01 for ; Thu, 17 Nov 2022 10:10:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 41E7468BCBB; Thu, 17 Nov 2022 12:10:07 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DCD0368BA90 for ; Thu, 17 Nov 2022 12:09:58 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id A047D240591 for ; Thu, 17 Nov 2022 11:09:58 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id AnqSHWB1uixp for ; Thu, 17 Nov 2022 11:09:56 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 7EAB22404F7 for ; Thu, 17 Nov 2022 11:09:56 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 1E9773A0520 for ; Thu, 17 Nov 2022 11:09:50 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Nov 2022 11:09:38 +0100 Message-Id: <20221117100942.6217-3-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117100942.6217-1-anton@khirnov.net> References: <20221117100942.6217-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] doc/developer.texi: update the language feature section X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: It is currently very out of touch with reality. * declare we are using C99 fully, rather than C90 plus extensions * mention our use of stdatomic.h * mention forbidden C99 features, like VLAs and complex numbers --- doc/developer.texi | 49 ++++++++++++---------------------------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/doc/developer.texi b/doc/developer.texi index 8e6d9d8730..01735e07f5 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -58,54 +58,29 @@ and should try to fix issues their commit causes. @section C language features -FFmpeg is programmed in the ISO C90 language with a few additional -features from ISO C99, namely: - +FFmpeg is programmed in the ISO C99 language, extended with: @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. +Atomic operations from C11 @file{stdatomic.h}. They are emulated on +architectures/compilers that do not support them, so all FFmpeg-internal code +may use atomics without any extra checks. However, @file{stdatomic.h} must not +be included in public headers, so they stay C99-compatible. @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: +Compiler-specific extensions may be used with good reason, but must not be +depended on, i.e. the code must still compile and work with compilers lacking +the extension. +The following C99 features must not be used anywhere in the codebase: @itemize @bullet @item -mixing statements and declarations; - -@item -@samp{long long} (use @samp{int64_t} instead); +variable-length arrays; @item -@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar; +complex numbers; @item -GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}). +mixed statements and declarations. @end itemize @section Code formatting conventions -- 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".