On 12/9/2009 8:22 PM, Leif Hedstrom wrote:
I prefer char* too, +1 on that as the standard notation from me, going
forward at least (we can then decide either if we want to "fix" all
existing code, or just fix as we work on it).
Cheers,
-- leif
Regarding: char *x vs char* x, I am with K&R and GNU in preferring the
former for
the reason that C types are ... well messy and it is best to remember
that :)
The problem is that pointers really associate with the thing on the
right for the devilish
little reason that it makes it possible to differentiate a declaration
from a statement
and still have the ability to express any type one might want.
consider:
(int *) x;
vs
int (*x);
then consider the declaration:
int (* (* const (c[4])));
vs
int **const c[4];
of course we should probably be using typedef, but I am still of the
opinion that
char* foo deceptively implies that C has a much more sensible type
syntax than
it does. But then I also think that one should use &anArray[0] when one
really
means a pointer instead of counting on C's implict array->pointer
conversion.
In a past life I was a bit of a language lawyer before C++ broke me of
that. Now
I am just a pragmatist with old habits.
john