[ds6-devel] pointer ops

Chris Leishman chris@leishman.org
Sun Dec 29 15:04:52 2002


quote:

"* The pointer operators * and & must go __before__ a variable of 
function
   name and not after the pointer type. Also, in casts there must be a 
space
   between the pointer type and the * or & operator.
   For instance, don't write:"


Hahaha...I guess I let a few of those slip through huh?  Thats one of 
my preferences over linus, I really think the operators should go with 
the type, since they are part of the type definition.

Eg. "int *blah"  is a variable "blah" that is of type "pointer to 
integer".  So the "int *" is defining the type.  This is made quite 
obvious with the cast operator (eg. (int *)blah) where the type is 
clearly differentiated from the variable.

Of course, the argument against this is that the syntax:

"int* blah, blah2"

in variable declaration doesn't create two integer pointers - but I 
personally think this is a C syntax bug, and I prefer to declare them 
separately on two lines.  *shrug*
This all probably stems from a strong functional language background....

But I'll try harder to catch any of those in future and do it your way 
:)

Regards,
Chris



More information about the ds6-devel mailing list