[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: [XaraXtreme-dev] Patch for spelling and white space consistency

On Wed, 29 Mar 2006 12:48:09 +0100, Phil Martin wrote:
>     TCHAR* variable;      // Correct
>     TCHAR *variable;      // Incorrect
> The logic for this one is that the variable you are declaring is a 
> pointer to a TCHAR (it will be the size of a pointer) and so it makes 
> more sense for the code to express that.

It would be nice if the syntax for variable declarations allowed this
style to be used consistently this way. But, unfortunately, this style
can lead to mistakes such as:

	TCHAR* ptr1, ptr2;

Which has the appearance of declaring two symmetric pointers to TCHAR
but in face declares one pointer to TCHAR and one TCHAR.

This is why I greatly prefer a style which would have the correct
version of the code be:

	TCHAR *ptr1, *ptr2;

> >-const TCHAR *cc_lstrstr(const TCHAR *String1, const TCHAR *String2);
> >+const TCHAR* cc_lstrstr(const TCHAR *String1, const TCHAR *String2);

In the case of a function's return value, I definitely agree that the
'*' belongs next to the type and not next to the function name.


Attachment: pgpdyHXIbLkbr.pgp
Description: PGP signature