Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Endian mini-review
From: Beman Dawes (bdawes_at_[hidden])
Date: 2015-01-26 16:00:21


On Mon, Jan 26, 2015 at 10:11 AM, Peter Dimov <lists_at_[hidden]> wrote:
...
>
> However, this allows me to sneak in another comment. Currently, if I try to
> put 0x123456 into a 16 bit buffer, it silently cuts it to 0x3456 without
> missing a beat. This is sometimes, but very rarely, what we want. Typically,
> what one wants in this case is an exception, because this usually happens
> when writing a file, and if one tries to write 0x123456 and only 0x3456
> comes out, it's likely that the result will be corrupted and unreadable.

Good idea!

Perhaps an error checking policy could be added as a template
parameter, with two supplied - one a nop, the other throwing an
exception on overflow.

I'll document that somewhere as a high priority for the future.

--Beman


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