Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-20 13:57:12


"Phil Nash" <phil.nash.lists_at_[hidden]> writes:

>> >> > Pointers are Resources
>> >> > Resources are not (all) Pointers.
>> >>
>> >> Actually,
>> >>
>> >> Pointers *refer to* resources
>> >> Not all pointers refer to (are) resources
>> >
>> > How about:
>> >
>> > Pointers are a way of referring to resources.
>> > Not all ways of referring to resources are pointers.
>
> Alright - it seems everyone pulled me up on that lapse - I must remember to
> be more careful round here ;-)
>
>> But also:
>>
>> Not all pointers refer to resources.
>
> Hmmm, unless you are thinking of null pointers I can't think of any pointers
> that don't refer to resources. Perhaps we have a different definition of
> resource?
> Could you elaborate?

I think of resources as things which can be separately managed
independent of other objects. Here are some examples of non-resource
pointers:

void f()
{
    int x;
    int* p1 = x; // arguable
    std::pair<int,int> y;
    int* p2 = x.first;
    std::pair<int,int>* y2 = new std::pair<int,int>;
    int* p3 = y2.first;
}

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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