C++ Logo


Advanced search

Subject: What even happened to <net> and byte swapping?
From: Matthew Woehlke (mwoehlke.floss_at_[hidden])
Date: 2021-02-19 09:41:02

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?


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

Older Archives on Google Groups