Boost logo

Boost :

From: Floris van den Berg (flvdberg_at_[hidden])
Date: 2003-05-03 19:06:34


From: "Noel Yap" <Noel.Yap_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Sunday, May 04, 2003 1:32 AM
Subject: Re: [boost] Re: in/out parameters, codingstylesandmaintenance

> BTW, I don't see why shy away from pointers. Is it only raw pointers
> you don't like, or also wrapped pointers? Why? Why don't you consider
> references to be pointers that are implicitly dereferenced (a sort of
> built-in pointer wrapper, if you will)?

Seeing a reference as a special pointer is imo fundamentally wrong. A
reference is an alias for a variable, whereas a pointer is a memory address.
Therefore you never need to check a reference for existence, or deallocate
memory while for a pointer you must. Using a auto_ptr, a wrapper for
pointers, on references is therefore plain wrong. As for in, in_out and out
parameters: you use it to make it apparent in your sourcecode and at
compile-time which function parameters are changed and which not. You need 3
different templates for this. If you propagate everything back to one
dumb_ptr or auto_ptr or whatever you want to call it, you essentially ruin
the beauty of the whole system.

Just my two cents.
Floris


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