Boost logo

Boost :

Subject: Re: [boost] [system] A non-allocating message() overload
From: Peter Dimov (lists_at_[hidden])
Date: 2018-09-20 12:36:09


charleyb123 wrote:
> Not to wander, but does this then suggest there might be interest in the
> two-call idiom to detect the buffer-size *required*, so the caller can
> allocate? (This has become increasingly popular such as in the Vulkan
> APIs, and Microsoft create-process/console functions), for example see:
> [...]

This is fairly idiomatic in MS land, but for this specific API, neither
strerror_r nor FormatMessage give you a length, and user implementations
typically won't be able to either (you compose the message with something
like snprintf and it doesn't give you the final length either.)

And it's not that critical. Messages are typically bounded by something
reasonable and truncation is not that big of a problem.


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