[hatari-devel] #include missing?!?
Eero Tamminen
eerot at users.berlios.de
Sun Sep 26 17:49:51 CEST 2010
Hi,
On Sunday 26 September 2010, Thomas Huth wrote:
> > [1] Thomas, maybe you could add short coding Dos & Don'ts text
> > under doc/?
>
> Ok, I added a coding.txt file with some points that just came to
> my mind. Does that list look reasonable?
Yes, thanks!
Regarding this:
------------
- In C source code, put opening curly brackets on new lines, e.g.:
...
- Note that Hatari uses also some code from other projects, e.g. the UAE
CPU files, which use another coding style than the main source code.
We keep the original coding style there for compatibility with the origin.
So always try to adapt to the coding style of the file that you're
currently editing.
------------
From the projects which code Hatari uses, STonX and I guess also WinSTon
used that convention, but UAE, Aranym and Qemu[1] seem to use
the convention where the curly bracket is on the same line:
if (condition) {
<block>
} else {
<block>
}
Code-wise UAE and Aranym stuff (CPU & DSP emulation) are about half
of the code lines in Hatari, file-wise only a small portion.
Me and Laurent have used the UAE/Aranym brace convention on some
(completely) new files too. I e.g. on debugger stuff and Laurent on mic &
crossbar.
So I would suggest that for (completely) new files one can pick either of
these styles, but the same brace style should be used in the whole file.
On quick look at the upstream UAE sources seems to have indentation of 4 and
mix spaces & TAB, but I think it's better if we stick to tabs as mixing
gives problems and one can specify in one's editor how those are shown.
- Eero
[1] PS. authors.txt doesn't seem to mention that at least part of the IDE
code comes from Qemu.
More information about the hatari-devel
mailing list