Talk:Coding Style

From ReactOS Wiki
Revision as of 08:48, 8 May 2005 by GvG (talk | contribs)
Jump to: navigation, search

We already have Programming_Guidelines

GvG: Using tabs for indentation is simply not acceptable for me. I do most of the editing in plain Notepad which doesn't allow you to set a tab width. Having to use 8-char tabs takes way too much space. I'm not about to change my tools (Notepad) to conform to some arbitrary standard, instead the standard should support all tools. Also personally I'd like even single statements embraced in {}, but I can live with that.

sedwards: Yes this bothers me as well. Mainly its the case where someone uses MSVC and sticks tabs all over the places where they really just want four spaces. Of course MSVC defaults to 4 spaces to tab while the rest of the world uses 8 so the code looks unreadable in notepad or less.

Parameters

Even with these statements, there's more than one way to put parameters (ignoring the { issue):

1: (I think this is what MS uses)

function(
    arg1,
    arg2
) {

2: try to align the arguments

function(arg1,
         arg2) {

3: (just make really long lines and have it wrap)

function(arg1,arg2,arg3,ar
g4) {

I'd be for either the first or second but in case of the first indent them more than 4 spaces.

Tinus 23:35, 7 May 2005 (CEST)

API headers

I think you could be more clear in stating that the header format is important for automatic tools like doxygen. Also the formatting of the function declaration itself is important (function name at the beginning of the line, etc.).

How should a static function be declared?

Tinus 23:35, 7 May 2005 (CEST)

Static function: maybe like this:

static DWORD
FunctionName()

GvG 10:48, 8 May 2005 (CEST)

{ } around single statements

I think this is more correct:

if (bla)
{
    dosomething();
    dosomething2();
}
else
{
    dosomething3();
}

e.g. put braces around the else stuff because it's on the if stuff too.

Tinus 23:35, 7 May 2005 (CEST)