Re: UVM typedef struct

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Holland
Date: Friday, June 19, 2009 - 12:04 pm

On Fri, Jun 19, 2009 at 02:57:14PM -0400, Greg A. Woods wrote:
 > > > > Historically, *_t types are primitive types
 > > > 
 > > > No, not really, especially not in C generally (perhaps in Unix, but
 > > > there are perhaps other explanations for why Unix code failed to use
 > > > this powerful idiom as uniformly as it should have).
 > > 
 > > Historically in Unix, though, which is the point.
 > 
 > Historically in Unix it doesn't matter though -- Unix had too much
 > baggage carried forward from the days before the invention of "typedef".

Yes, and that baggage was kept precisely because of the distinctions
I've cited.

 > >  > 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
 > 
 > Well, yes, up to the point where "typedef" came into being at least.
 > 
 > Since then "typedef" offers a way to name any kind of type, primitive or
 > otherwise.

You are talking about what is possible; I am talking about historic
practice in the kernel and the ... more important parts of userland.

 > > 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.
 > 
 > The point with "_t" is to distinguish the type alias name as being a
 > typedef name, not in how the underlying data structure is used
 > regardless of whether it is a pointer, struct, or union.

This is entirely pointless.

 > Use of "_t"
 > for all typedef names is a convention that helps both human 

Not likely. Or do you also advocate full Hungarian notation?

 > and computer

Bollocks.

 > distinguish the unique properties of these unique identifiers.  They are
 > not labels on storage (text or data) they are labels on language
 > constructs and as such it is critically important that they be treated
 > as unique.
 > 
 > > Myself, I don't see any great need to tag them, as the distinction
 > > between types and values is abundantly clear from syntax,
 > 
 > I certainly don't agree at all with the use of "abundantly" there.

There are very few cases where they aren't clear to a human reading
sane code. Arguably, any such case is a bug.

Meanwhile, the compiler has a symbol table and doesn't care in the
least.

 > I'm talking about human factors

So am I, that's the point.

However, it appears that it's a lost cause. Someone even went and
created a vnode_t, for heaven's sakes.

-- 
David A. Holland
dholland@netbsd.org
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
UVM typedef struct, Mindaugas Rasiukevicius, (Mon Jun 15, 12:09 pm)
Re: UVM typedef struct, der Mouse, (Mon Jun 15, 12:13 pm)
Re: UVM typedef struct, Masao Uebayashi, (Mon Jun 15, 9:43 pm)
Re: UVM typedef struct, Antti Kantee, (Mon Jun 15, 10:37 pm)
Re: UVM typedef struct, Peter Seebach, (Mon Jun 15, 10:45 pm)
Re: UVM typedef struct, Mindaugas Rasiukevicius, (Tue Jun 16, 2:19 am)
Re: UVM typedef struct, Eric Haszlakiewicz, (Tue Jun 16, 7:55 am)
re: UVM typedef struct, matthew green, (Tue Jun 16, 8:16 am)
Re: UVM typedef struct, David Laight, (Tue Jun 16, 8:46 am)
Re: UVM typedef struct, Antti Kantee, (Tue Jun 16, 12:02 pm)
Re: UVM typedef struct, Mindaugas Rasiukevicius, (Tue Jun 16, 1:00 pm)
re: UVM typedef struct, matthew green, (Tue Jun 16, 1:14 pm)
Re: UVM typedef struct, Antti Kantee, (Tue Jun 16, 4:21 pm)
Re: UVM typedef struct, der Mouse, (Tue Jun 16, 4:42 pm)
Re: UVM typedef struct, Masao Uebayashi, (Tue Jun 16, 5:28 pm)
Re: UVM typedef struct, Eric Haszlakiewicz, (Tue Jun 16, 9:47 pm)
re: UVM typedef struct, matthew green, (Tue Jun 16, 11:02 pm)
Re: UVM typedef struct, David Laight, (Tue Jun 16, 11:42 pm)
Re: UVM typedef struct, Reinoud Zandijk, (Wed Jun 17, 4:01 am)
Re: UVM typedef struct, Terry Moore, (Wed Jun 17, 2:05 pm)
Re: UVM typedef struct, James Chacon, (Wed Jun 17, 3:14 pm)
Re: UVM typedef struct, Terry Moore, (Wed Jun 17, 4:22 pm)
Re: UVM typedef struct, David Holland, (Fri Jun 19, 10:18 am)
Re: UVM typedef struct, Greg A. Woods, (Fri Jun 19, 10:51 am)
Re: UVM typedef struct, David Holland, (Fri Jun 19, 11:21 am)
Re: UVM typedef struct, Greg A. Woods, (Fri Jun 19, 11:57 am)
Re: UVM typedef struct, David Holland, (Fri Jun 19, 12:04 pm)
Re: UVM typedef struct, tlaronde, (Sat Jun 20, 3:05 am)
Re: UVM typedef struct, Chuck Cranor, (Wed Jul 22, 9:39 am)
Re: UVM typedef struct, David Holland, (Wed Jul 22, 9:45 am)
Re: UVM typedef struct, Jason Thorpe, (Mon Aug 10, 5:42 pm)
Re: UVM typedef struct, Jason Thorpe, (Mon Aug 10, 5:43 pm)
Re: UVM typedef struct, Jason Thorpe, (Mon Aug 10, 5:45 pm)
Re: UVM typedef struct, Jason Thorpe, (Mon Aug 10, 5:50 pm)
Re: UVM typedef struct, David Holland, (Mon Aug 10, 11:37 pm)
Re: UVM typedef struct, David Laight, (Mon Aug 10, 11:44 pm)
Re: UVM typedef struct, David Holland, (Mon Aug 10, 11:45 pm)
Re: UVM typedef struct, Peter Seebach, (Tue Aug 11, 12:18 am)
Re: UVM typedef struct, Matthew Mondor, (Tue Aug 11, 12:19 am)
Re: UVM typedef struct, der Mouse, (Tue Aug 11, 12:38 am)
Re: UVM typedef struct, David Holland, (Tue Aug 11, 12:48 am)
Re: UVM typedef struct, David Holland, (Tue Aug 11, 12:50 am)
Re: UVM typedef struct, Peter Seebach, (Tue Aug 11, 1:10 am)
Re: UVM typedef struct, David Holland, (Tue Aug 11, 9:35 am)
Re: UVM typedef struct, Peter Seebach, (Tue Aug 11, 10:16 am)
Re: UVM typedef struct, Eric Haszlakiewicz, (Tue Aug 11, 10:42 am)
Re: UVM typedef struct, David Holland, (Tue Aug 11, 11:00 am)
Re: UVM typedef struct, Eric Haszlakiewicz, (Wed Aug 12, 9:42 am)
Re: UVM typedef struct, David Holland, (Wed Aug 12, 9:50 am)
Re: UVM typedef struct, Eric Haszlakiewicz, (Wed Aug 12, 11:29 am)
Re: UVM typedef struct, Tonnerre LOMBARD, (Wed Aug 12, 1:32 pm)
Re: UVM typedef struct, Iain Hibbert, (Wed Aug 12, 2:17 pm)
Re: UVM typedef struct, Tonnerre LOMBARD, (Wed Aug 12, 3:07 pm)
Re: UVM typedef struct, James Chacon, (Wed Aug 12, 5:21 pm)
Re: UVM typedef struct, Iain Hibbert, (Wed Aug 12, 11:19 pm)
Re: UVM typedef struct, Alan Barrett, (Thu Aug 13, 12:00 am)
Re: UVM typedef struct, Tonnerre LOMBARD, (Thu Aug 13, 11:55 am)
Re: UVM typedef struct, Tonnerre LOMBARD, (Thu Aug 13, 11:57 am)