[hatari-devel] Coding style

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

Regarding this commit:
--------------------------
commit 976e2238d24c413b76e2c2f0bb2937ee34dd5363
Author: Thomas Huth <huth@xxxxxxxxxxxxx>
Date:   Sat May 2 09:23:52 2020 +0200

    Fix coding style in statusbar.c

    statusbar.c is not derived from another
    project, so we should use the main Hatari
    coding style here and put curly braces on
    new lines.
---------------------------

It didn't fix anything.


Our coding style document:
https://hatari.tuxfamily.org/doc/coding.txt

Says:
---------------------------
....
try to adapt to the coding style of the file that
you're currently editing.

- For new files, pick one of the existing coding
  styles, don't add a new one.
---------------------------

That file had consistent style from the beginning,
similar to brace usage in several other Hatari
source files, other still actively maintained m68k
related projects [1], and other code I've been
recently involved with [2].


Because our main upstream projects are WinUAE,
Qemu and Aranym [3], and all of those use brace-
on-same-line style, I'm proposing that we adopt
that as the default style for rest of the Hatari
code too, for consistency's sake.

I would prefer using braces always (as Qemu does),
but WinAUE & Aranym often skip braces when they
aren't strictly needef, so I'm fine with both.


If agreed, I can convert src/debug/*.c files to
that convention as I'm nowadays doing most of
maintenance for that code, and several of the
files there already use brace-on-same-line style
[4].

Rest of the files could be converted later on, but
that needs input from Previous downstream project
in case it is still synching some code with
Hatari.


NOTE: I'm not proposing anything for other items
typically listed in coding style documents [4][5],
as I didn't find any consistency to things
documented in existing Hatari related projects.


	- Eero

[1] WinUAE, EmuTOS, Linux m68k [4], Qemu, Aranym [3]...

[2] I recently started learning Golang.  It has
    gofmt tool which enforces brace-on-same-line
    formatting for all code...

[3] Aranym has multiple styles like Hatari, for
some reason even in files that are copyrighted
by a single same person?

[4] as described here:
https://www.kernel.org/doc/html/latest/process/coding-style.html

[5] Qemu uses brace-on-same-line, but different
indenting:
https://git.qemu.org/?p=qemu.git;a=blob_plain;f=CODING_STYLE.rst;hb=HEAD



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/