Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2002-01-12 15:51:34


----- Original Message -----
From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, January 12, 2002 11:35 AM
Subject: Re: [boost] Loki SmartPtr questions

> However, smart pointer member functions defeat train by habit. Raw
pointers
> don't have member functions, so C++ programmers' eyes are not inhabited to
> detect and distinguish dot calls from arrow calls. The compiler does a
good
> job at that - if you use a dot after a raw pointer, the compiler will
yield
> an error. Therefore, it is easy to imagine, and experience actually proves
> it, that even seasoned C++ programmers find it extremely disturbing that
> both sp.Release() and sp->Release() compile flag-free, but do very
different
> things.

In practice I have not found this to be a problem.

> Overloaded functions can be just as confusing as member functions of smart
> pointers, but there is an important difference. C++ programmers already
use
> overloaded functions. Overloading is an important part of the C++ language
> and is used routinely in library and application development. This means
> that C++ programmers do pay attention to differences in function call
> syntax - such as Release(*sp) versus Release(sp) - in writing and
reviewing
> code.

I tend to think of a overloaded function as a single generic function.
Therefore I find a single function overloaded with significantly different
semantics more confusing that member functions for smart pointers.

--
Rainer Deyke (root_at_[hidden])
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk