[gameprogrammer] Re: A Note on C Programming Style

Robert Chafer wrote:

>I prefer char *p :)
>
>I think char* p is misleading. How would you write 
>
>char *p, q, *r; 
>
>Not that it really matters much :)  to misquote the Borg: spaces are
>irrelevant.
>  
>

One things I've seen in a few projects I've helped with, is that people 
who prefer to think of pointers as their own data type often do this:

typedef char* char_p;

Then they can do things like...

char_p p, q, r;

...without causing weirdness.  Actually, the main purpose in what I've 
seen seemed to be to abstract their data types, but the nice side effect 
was that those of them who prefered to treat pointers as effectively 
different data types could still write intuitive code.  As for whether 
it makes more sense, I guess it depends on how you usually use your 
pointers.

Ryan


>On Thu, 5 May 2005 13:52:42 -0700, you wrote:
>
>  
>
>> Wes you are the only person that i have talked to that sees the value
>> of char *p instead of char* p.
>> 
>> my hat is off to you (:
>> 
>>    
>>
>
>--
>
>Rob Chafer
>Silverfrost
>
>
>---------------------
>To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>
>
>  
>




---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: