Boost logo

Boost :

Subject: Re: [boost] [system][filesystem v3] Question about error_code arguments
From: Michael Caisse (boost_at_[hidden])
Date: 2009-10-20 12:07:31


Thomas Klimpel wrote:
> Beman Dawes wrote:
>
>> One particular concern is that as currently worded, the N2838 proposal
>> requires throws() return a null reference, which they see as relying
>> on undefined behavior.
>> ...
>>
>> Although I could personally live with either form, I'm leaning
>> slightly toward the pointer form.
>>
>> Regardless, I'd like to hear Boosters views on the two interfaces
>> above. Which do you prefer? Why?
>>
>
> I don't know the details, but I also would prefer the pointer interface. "null reference" reminds me of somebody actually checking against a null reference:
>
> void f(int& r) {
> if (&r) // check whether r is a null reference
> ... ;
> g(&r);
> }
>
> I have no problem if "r" could be undefined, i.e. somebody called "f(*p);" with a "p" that is null or undefined. I also don't have a problem if "g" checks the pointer it is passed in against null. However, if "f" itself checks its argument against being a null reference, then I'm disappointed. As another poster said: "I thought one of the selling points of references was they can't be null."
>
>

My exact thoughts.

michael

-- 
----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com

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