tech-kern archive

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

Re: UVM typedef struct



On Tue, 11 Aug 2009 06:45:11 +0000
David Holland <dholland-tech%netbsd.org@localhost> wrote:

> On Mon, Aug 10, 2009 at 05:45:54PM -0700, Jason Thorpe wrote:
> >
> > No, the real benefit is "x * -> x_t".
> 
> That is not a benefit. What does it buy you? Absolutely nothing. What
> does it cost you? A lot of clarity. It invites memory leaks, refcount
> bugs, accidental sharing of things you meant to have your own copy of,
> sometimes accidental copying of things you meant to share, and worse,
> all because you're wilfully and gratuitously blurring the distinction
> between a value and a pointer to a value.

I agree, I see the benefit of exposing public structures of an API as
typedefs, but it isn't good practice to me to hide the pointer inside,
unless the name specifically contains addr or ptr in it (and I've seen
cases where *addr_t typedefs were long, uint32_t or the like instead of
a pointer, so addr is still not obvious)...
-- 
Matt


Home | Main Index | Thread Index | Old Index