Date: Fri, 19 Feb 2021 16:54:37 +0100
On Fri, Feb 19, 2021 at 10:41:02AM -0500, Matthew Woehlke via Std-Discussion wrote:
> I was looking at some code that needs to do byte-order swapping, and it
> seems the most portable way is still the non-standard htonX/ntohX family of
> functions.
>
> N3783 proposed standardizing these back in 2013(!)... but it doesn't seem
> that this ever happened. We got std::endian (finally) in C++20, but there do
> not seem to be any accompanying conversion functions.
>
> Am I missing something, or do we still not have a way in standard C++ to
> swap byte order of integer values?
Not yet at least, but there is
https://github.com/cplusplus/papers/issues/270 in progress.
Christof
> I was looking at some code that needs to do byte-order swapping, and it
> seems the most portable way is still the non-standard htonX/ntohX family of
> functions.
>
> N3783 proposed standardizing these back in 2013(!)... but it doesn't seem
> that this ever happened. We got std::endian (finally) in C++20, but there do
> not seem to be any accompanying conversion functions.
>
> Am I missing something, or do we still not have a way in standard C++ to
> swap byte order of integer values?
Not yet at least, but there is
https://github.com/cplusplus/papers/issues/270 in progress.
Christof
-- http://cmeerw.org sip:cmeerw at cmeerw.org mailto:cmeerw at cmeerw.org xmpp:cmeerw at cmeerw.org
Received on 2021-02-19 09:54:51