On Sun, Aug 09, 2009 at 06:19:43PM +0200, you...@lyx.org wrote: > Author: younes Date: Sun Aug 9 18:19:43 2009 New Revision: 30947 URL: > http://www.lyx.org/trac/changeset/30947 > > Log: Text::Inset(): now returns a reference in order to make clear > that the owner is mandatory.
One of the things I learned recently is that code gains clarity if passing by-ref or by-pointer is based on type, not in the fact whether the thing can be zero or not I understand that this is pretty much diametral to what is customarily taught, but it is so much easier to remember 'a Buffer is not (easily) copyable, so pass it by pointer' as opposed to 'this particular Buffer instance cannot be zero at this particular time, so I hope the function accepting it as argument already knows it and therefore takes a reference'. Pointer-or-reference-by-type also reduces "line noise" if form of '*' and '&' to a minimum. And the basic rule "reference if copyable (i.e. string, Paragraph, ...), pointer if not (Buffer, BufferView, ...)" is really easy to remember. Just food for thought. Andre'