tech-kern archive

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

Re: UVM typedef struct

On Fri, Jun 19, 2009 at 06:21:02PM +0000, David Holland wrote:
> [...]
>  > Historically the real reason for appending "_t" to typedef names is to
>  > mark the identifier as being a "type" -- i.e. it's a special identifier
>  > that exists in a unique namespace.
> Yes, it is a type, but it is a *primitive* type. Non-primitive types
> have been, historically, marked with 'struct' or 'union', and the
> desire to retain this visual distinction is why Unix code does not do
> the "typedef struct { ... } foo" idiom that much other C code does.
> Structs and particularly pointers are not used the same way (no matter
> how abstract they are!) and should be tagged, if tagged, with
> something other than _t.

FWIW, in Plan9 for example, a complex, composed type is lexically
identified by a first capital letter ; while primitive types are all 
lower case.


typedef struct Tm {} Tm;

This is IMHO sound, since complex, composite type are special,
extensions of the language in some sense.
tHIerry Laronde (Alceste) <tlaronde +AT+ polynum +dot+ com>
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C

Home | Main Index | Thread Index | Old Index