Re: [RFC] struct *_struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 05, 2010 at 11:20:14AM -0500, Michael Witten wrote:
> On Wed, Aug 4, 2010 at 14:24, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> > I hate... "typedef foo struct foo"
> 
> How come?

In my opinion, it creates ambiguity. If I have
    
    typedef struct foo foo;

And I have "foo" used in a code snippet, it is much less easier to see
if foo is being used in the type context or if its an instance, since
I like to do

    struct foo foo;

which reads much less well as:

    foo foo;


Its also much less easier to grep though to find all the places the
type is used. If I do

    $ git grep "foo"

I will end up with the instances and the struct type. whereas I can do

    $ git grep "struct foo"

to find (most|all) of the types, depending on whether the code uses
decent practices (there shouldn't be a second space between struct and
foo, or a newline between them).

I could also use a similar regular expression to find all the
instances (ie, all the instances of foo that aren't prefixed with
struct).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]