[FFmpeg-devel] [PATCH] doc/developper: always use braces for statements

Alexander Strasser eclipse7 at gmx.net
Wed Aug 7 01:14:06 EEST 2019


On 2019-08-06 22:51 +0200, Nicolas George wrote:
> Tomas Härdin (12019-08-06):
> > I think they should. See
>
> Documenting the coding standard and changing it are different matters.

I guess a change was intended, because it should be fairly obvious
that in the current code base the described style for ifs with a single
statement body is barely used.

IMHO the only con is that it uses up more vertical space (one line
more, when sticking with the brace placement as is) and thus less real
code fits on a screen/page.

Anyway despite of other things pointed out below. There are additional
advantages like making it easier to debug and to extend the code with
less changes. In turn making the potentially resulting patches shorter
and easier to read.


> > https://www.imperialviolet.org/2014/02/22/applebug.html
>
> test_warn.c: In function ‘test’:
> test_warn.c:6:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
>      if (x == y)
>      ^~
> test_warn.c:8:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
>          return -1;
>          ^~~~~~


After all Style is subjective, and thus of course you are right,
Nicolas, changes to the coding style should be discussed and not
be tunneled through documentation patches. Though I don't think
the latter was the intention of the OP. Clearly communicating the
request for change would have been better though.


  Alexander


More information about the ffmpeg-devel mailing list