Boost logo

Boost :

Subject: Re: [boost] [system][filesystem v3] Question about error_code arguments
From: Detlef Vollmann (dv_at_[hidden])
Date: 2009-10-20 17:44:55


Andrey Semashev wrote:
> 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 comparison
> of two integers. Even if referencing the global default instance does
> add overhead, I bet it is negligible.
No, it isn't. The null pointer will be in a register, while the
global object might not even be in the cache.
And this for functions that are called by the thousands per second
on a busy server.

   Detlef

PS: This was one of the main reasons why the POSIX/C++ group is
in favour of the pointer.


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