On Sunday, 17 March 2013 01:01:18 UTC+2, Paavo Helde wrote:
> Also, a raw pointer is only needed if it can be NULL or must support
> reseating, otherwise one should use references to reduce the complexity
> of the code. For example, navigation could often be done via references
> only. Not quite sure if Tiib or James included references in the notion
> of naked pointers or not.
Reference is not pointer because it is not so loose. Reference is great
as function parameter or for naming and extending life-span of temporary
in code. As data member it is useful if there is need to store a reference
to a composite in component. The only dangerous usage of reference is as
return value and that is fault of compilers. All cases of returning
reference to a local or temporary must be very apparent to compilers,
so compiling such things silently feels criminal.