$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [system] Would it be possible to trial a breaking change to Boost.System and see what happens?
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2018-01-15 22:48:10
On 15/01/2018 13:01, Niall Douglas wrote:
> Is anybody actually generating a totally unique message per invocation
> for the same error code which couldn't be cached and reused? I've never
> seen it yet. Almost all use of message() is for printing to human
> readable output.
The most common dynamic message generation case is where a standard 
message can't be found, so it returns a generic "error #nnn occurred" 
message.  While these *could* be cached, it seems a bit wasteful, 
especially if nothing eventually tidies them away (but when is it safe 
to do so?).
But there are other cases as well; Windows' FormatMessage allows 
specifying additional parameters to fill in replacement values for parts 
of the text, which might be contextual information about eg. which file 
couldn't be loaded.  And the standard error messages usually are defined 
with these parameters in mind.
Granted in the context of an error_code alone being passed around it's 
unlikely for there to be sufficient context to supply the parameters 
except back at the original error site (which then isn't an error_code 
any more) -- but given something like outcome which can pass the error 
code *and* the necessary parameters to fill in the message when it does 
eventually get converted to text, that becomes more useful.