typedefs and structs

linas linas at austin.ibm.com
Thu Nov 10 06:38:28 EST 2005


On Wed, Nov 09, 2005 at 11:36:25AM -0800, thockin at hockin.org 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



More information about the Linuxppc64-dev mailing list