Talk:Coding Style

From ReactOS Wiki
Jump to: navigation, search

We already have Programming_Guidelines --Dr. Fred 20:07, 8 May 2005 (CEST)

You can change the tab size in Eclipse: tutorial : Tinus 00:27, 11 May 2005 (CEST)

Tabs

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)

I totally agree. In this case braces must be put. I don't think there's any discussion about this, this is a given.

--Alex Ionescu 19:46, 8 May 2005 (CEST)

White lines

Can we have white lines that contains some tabs (as many as the indentation level)?

ie ( __ is a tabulation):

{
__ULONG i;
__
__i = 0;
__...
}

instead of

{
__ULONG i;

__i = 0;
__...
}

--Hervé Poussineau 18:25, 9 May 2005 (GMT+2)

That's a horrible idea...Steven has just spent the whole weekend removing such horrifities... it makes diffing a mess and wastes spaces. --Alex Ionescu 15:52, 10 May 2005 (CEST)