Re: typedefs and structs

From: linas
Date: Tue Nov 08 2005 - 19:42:53 EST


On Tue, Nov 08, 2005 at 05:13:48PM -0700, Zan Lynx was heard to remark:
> On Wed, 2005-11-09 at 10:57 +1100, David Gibson wrote:
> >
> > I hate it: it obscures the fact that it's a pass-by-reference at the
> > callsite, which is useful information. Although this is, admittedly,
> > the least confusing use of C++ reference types.
>
> I agree with you about that one. It's yet another thing for C
> programmers to have to learn to watch for C++ doing behind your back.

I think you're rushing to judgement on something you've never tried.
It fundamentally changes coding style; you'd have to try it on some
mid-size project for at least a few months or longer to get into the
mindset. To make it all work, you also have to do other things, like
avoid mallocs and allocing on stack, which forces major changes of
style (because of the lifetime of things on stack). If you don't change
style to go with it, then you'll just end up in debug hell, in which
case you'd be right: it would be a (very) bad idea.

(Disclaimer: I've moved away from C++ because of all the other
opportunities for misuse that it offers and encourages.)

--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/