That's the exact reason why I say char *foo is the "right" way to do it. I think a subject like this even brings a bigger picture topic to light in that a coding standard might even want to avoid multiple declarations in the same line/statement for that very reason. As I get "on" in years I tend to eschew the typing shortcuts and syntactical sugar (I used to use all the time) in favor of clarity and readability. Besides, compiler writers are WAY smarter than I am so I figure let them do the optimizing and I'll not worry about using up (cheap) disk space being more verbose in my intent.
Or you could just compromise and go the char * foo route...it drives me nuts when I see code like that... ;) D.J. -----Original Message----- From: Dossy Shiobara [mailto:do...@panoptic.com] Sent: Thursday, December 10, 2009 6:01 AM To: trafficserver-dev@incubator.apache.org Cc: Leif Hedstrom; Bryan Call Subject: Re: coding style On 12/9/09 11:22 PM, Leif Hedstrom wrote: >>> * From the example, it seems like '*' is associated with the variable >>> and not the type, i.e., 'char *arg' and not 'char* arg'. Can we state >>> this explicitly and also clarify whether this applies to references >>> also? >>> >> I prefer char* s, but as it currently stands the code has a lot more >> char *s >> > > 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). Uh, isn't the '*' actually associated with the variable? If "char*" were a type, then: char* a, b, c; Are "b" and "c" the same "char*" type? Not according to the rules. They are "char" type. char *a, *b, *c; Now, what type are "b" and "c"? Would you rather see: char* a, *b, *c; -- Dossy Shiobara | do...@panoptic.com | http://dossy.org/ Panoptic Computer Network | http://panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)