Re: typedefs and structs
From: thockin
Date: Wed Nov 09 2005 - 14:26:29 EST
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.
> 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! If you're storing references you absolutley still need
reference counting. Allocation non-trivial things on the stack is Bad
Idea in kernel land.
-
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/