
|
[haiku-development]
||
[Date Prev]
[03-2008 Date Index]
[Date Next]
||
[Thread Prev]
[03-2008 Thread Index]
[Thread Next]
[haiku-development] Re: coding style
- From: "Michael Lotz" <mmlr@xxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Mon, 03 Mar 2008 12:50:30 +0100
> Marcus Overhagen wrote:
> >> * use "char* variable" instead of "char *variable" in C++ code
> >
> > I disagree with that one. The * belongs to the variable, not to the
> > type.
>
> I wonder why. When I see something like this:
>
> char* foo;
>
> I read that foo is a pointer to a char (foo's type is "char
> pointer").
> For me, moving * to be next to the variable name does not make much
> sense.
This is really the one thing I also disagree. For one thing it simply
looks ugly to me to have the * or & attached to the type, but this is a
preference with no real technical basis. BTW I could agree to "char*",
but it gets funny when you specify "const char*" or even "extern const
char*". It looks inconsistent to me to have spacing between the "const"
and the "char" and then not between the "char" and the "*". Of course
you cannot write "constchar*", but for me it looks more natural to be
consequent and have all the parts of the type separated by spaces which
results in "const char *".
After the type I apply 0 or more spacing tabs, which results in what
Marcus suggested "char * Method();" in the column header format
and in simply "const char *string = NULL" for variables.
Regards
Michael
|

|