coding style: type* variable or type *varible

Perret Yannick yperret@in2p3.fr
Wed Sep 14 10:41:00 GMT 2005



Dave Korn wrote:

>----Original Message----
>  
>
>>From: Mike Stump
>>Sent: 13 September 2005 20:28
>>    
>>
>
>  
>
>>On Sep 13, 2005, at 12:23 PM, Rafael Espíndola wrote:
>>    
>>
>>>I have seen both in gcc. I have found that "type* variable" is
>>>preferred in C++ code but I haven't found any guidelines for C code.
>>>      
>>>
>>If you ask gcc, you find:
>>
>>mrs $ grep 'int\* ' *.c | wc -l
>>        4
>>mrs $ grep 'int \*' *.c | wc -l
>>      369
>>
>>pretty clear to me.
>>    
>>
>
>  
>
My two cents...

Well, for my version of gcc (gcc-4.1-20050528), I only get 3 'int*', and all
the three are in comments, not in C code.

I also get 10 'int * '.

By my side, the only place I put int* is for casts.

Regards,
--
Yannick



More information about the Gcc mailing list