Subject: Re: [boost] [system][filesystem v3] Question about error_code arguments
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-10-20 16:10:27
Andrey Semashev wrote:
> Stewart, Robert wrote:
> > Beman Dawes wrote:
> > set, then there's no need for a null reference. Unfortunately, that
> > has a performance downside: the function must be called and the
> > temporary must be created or a reference to a global object must be
> > created for all calls that use the default. A null pointer default
> > must be cheaper.
> I think the performance cost of checking a reference or pointer for
> validity and checking some property in the error_code
> instance will be
> the same. After all, in both cases it comes down to a single
> of two integers. Even if referencing the global default instance does
> add overhead, I bet it is negligible.
I wasn't referring to checking the reference or pointer. Rather, I was pointing out that the reference must be bound to something when the default is accepted. Every call using the default implies code that acquires an object or reference to one to which the formal parameter can be bound. That is costlier than simply passing a null pointer unless some compiler magic is involved.
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk