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 6C668471CE for ; Tue, 29 Aug 2023 08:34:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7121968C602; Tue, 29 Aug 2023 11:34:53 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D063F68B683 for ; Tue, 29 Aug 2023 11:34:46 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 8488F2401A4 for ; Tue, 29 Aug 2023 10:34:46 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 7T6iVSEjHjhA for ; Tue, 29 Aug 2023 10:34:45 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (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 "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id DCCA6240177 for ; Tue, 29 Aug 2023 10:34:45 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id BEF801601B9; Tue, 29 Aug 2023 10:34:45 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: References: <20230826180748.15977-1-anton@khirnov.net> <20230826180748.15977-4-anton@khirnov.net> Mail-Followup-To: FFmpeg development discussions and patches Date: Tue, 29 Aug 2023 10:34:45 +0200 Message-ID: <169329808575.20400.4593289958410673620@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 4/6] doc/developer: add a code behaviour section to development policy 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: Quoting Stefano Sabatini (2023-08-27 14:38:44) > Il sab 26 ago 2023, 20:08 Anton Khirnov ha scritto: > > > Document our longstanding de facto policies on things like correctness, > > thread-safety, UB, etc. > > > > UB? undefined behavior > > --- > > doc/developer.texi | 50 +++++++++++++++++++++++++++++++++------------- > > 1 file changed, 36 insertions(+), 14 deletions(-) > > > > diff --git a/doc/developer.texi b/doc/developer.texi > > index df43119f98..afa0148137 100644 > > --- a/doc/developer.texi > > +++ b/doc/developer.texi > > @@ -274,10 +274,6 @@ symbols. If in doubt, just avoid names starting with > > @code{_} altogether. > > @section Miscellaneous conventions > > > > @itemize @bullet > > -@item > > -fprintf and printf are forbidden in libavformat and libavcodec, > > -please use av_log() instead. > > - > > @item > > Casts should be used only when necessary. Unneeded parentheses > > should also be avoided if they don't make the code easier to understand. > > @@ -286,6 +282,42 @@ should also be avoided if they don't make the code > > easier to understand. > > @anchor{Development Policy} > > @chapter Development Policy > > > > +@section Code behaviour > > + > > +@subheading Correctness > > +The code must be valid. It must not crash, abort, access invalid > > pointers, leak > > +memory, cause data races or signed integer overflow, or otherwise invoke > > +undefined behaviour. > > > Invoke => assume? No, 'assume' would mean something else. 'cause' maybe. > > Error codes should be checked and, when applicable, > > +forwarded to the caller. > > + > > +@subheading Thread- and library-safety > > +Our libraries may be called by multiple independent callers in the same > > process. > > +These calls may happen from any number of threads and the different call > > sites > > +may not be aware of each other - e.g. a user program may be calling us > > directly, > > > > Calling us -> calling the/our libraries I wanted to avoid using the word 'libraries' multiple times, to avoid possible confusion of which library is being talked about - whether ours or some external one. -- Anton Khirnov _______________________________________________ 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".