C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: What even happened to <net> and byte swapping?
From: Christof Meerwald (cmeerw_at_[hidden])
Date: 2021-02-19 09:54:37


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

-- 
http://cmeerw.org                              sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org                   xmpp:cmeerw at cmeerw.org

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups