* [FFmpeg-devel] [PR] RFC: Add preference of narrow variable scope, especially in loops, to the docs (PR #21808)
@ 2026-02-19 21:44 Marvin Scholz via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Marvin Scholz via ffmpeg-devel @ 2026-02-19 21:44 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
PR #21808 opened by Marvin Scholz (ePirat)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21808
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21808.patch
>From cdadf39f25d4ab4004da9f7244e888d53ee84946 Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epirat07@gmail.com>
Date: Thu, 19 Feb 2026 22:43:04 +0100
Subject: [PATCH] doc: add narrow variable scope in loops to style examples
---
doc/developer.texi | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/doc/developer.texi b/doc/developer.texi
index 10a2de00df..e5c33bbcae 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -224,6 +224,25 @@ AVStream *stream;
AVStream* stream;
@end example
+@item
+When sensible, prefer a narrow variable scope, especially in for loops:
+
+@example c, good
+// Good
+for (unsigned i = 0; i < submix->nb_elements; i++) {
+ // Do something...
+}
+@end example
+
+@example c, bad
+// Bad style
+unsigned i;
+//...
+for (i = 0; i < submix->nb_elements; i++) {
+ // Do something...
+}
+@end example
+
@end itemize
If you work on a file that does not follow these guidelines consistently,
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-19 21:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-19 21:44 [FFmpeg-devel] [PR] RFC: Add preference of narrow variable scope, especially in loops, to the docs (PR #21808) Marvin Scholz via ffmpeg-devel
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