Re: typedefs and structs

From: linas
Date: Wed Nov 09 2005 - 14:38:41 EST


On Wed, Nov 09, 2005 at 11:36:25AM -0800, thockin@xxxxxxxxxx was heard to remark:
> On Wed, Nov 09, 2005 at 01:20:28PM -0600, linas wrote:
> > I guess the real point that I'd wanted to make, and seems
> > to have gotten lost, was that by avoiding using pointers,
> > you end up designing code in a very different way, and you
> > can find out that often/usually, you don't need structs
> > filled with a zoo of pointers.
>
> Umm, references are implemented as pointers. Instead of a "zoo of
> pointers" you have a "zoo of references". No functional difference.

Sigh.

I think you are confusing references and pointers. By definition
you cannot "store a reference"; however, you can "dereference"
an object and store a pointer to it.

The C programming language conflates these two different ideas;
that is why they seem to be "the same thing" to you.

> > Minimizing pointers is good: less ref counting is needed,
> > fewer mallocs are needed, fewer locks are needed
> > (because of local/private scope!!), and null pointer
> > deref errors are less likely.
>
> Not true at all!

Which part isn't true?

--linas
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/