From e8530e4563f44d1a8d3b88340f7c49e4fb9d4e93 Mon Sep 17 00:00:00 2001 From: Beman Date: Thu, 11 Dec 2014 12:05:31 -0500 Subject: [PATCH] Add FAQ entry for built-in integer names. --- doc/conversion.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/conversion.html b/doc/conversion.html index ef10866..a79b408 100644 --- a/doc/conversion.html +++ b/doc/conversion.html @@ -98,7 +98,6 @@ namespace endian native = implementation-defined-as-big-or-little }; - TODO: Add overloads for char, wchar_t, char16_t, char32_t int8_t endian_reverse(int8_t x) noexcept; int16_t endian_reverse(int16_t x) noexcept; int32_t endian_reverse(int32_t x) noexcept; @@ -360,6 +359,17 @@ provided.

+

Why are 8, 16, 32, and 64-bit integers supported rather than the built-in +char, short, int, long, long long, etc?

+ +
+ +

The primary use case, portable file or network data, needs these de facto +standard sizes. Using types that vary with the platform would greatly limit +portability for both programs and data.

+ +
+

Acknowledgements

Tomas Puverle was instrumental in identifying and articulating the need to support endian conversion as separate from endian integer types. Phil Endecott suggested the form of the value returning signatures. Vicente Botet and other reviewers suggested supporting floating point types and user defined types. General reverse template implementation approach using std::reverse suggested by Mathias Gaunard. Portable implementation approach for 16, 32, and 64-bit integers suggested by tymofey, with avoidance of undefined behavior as suggested by Giovanni Piero Deretta, and a further refinement suggested by Pyry Jahkola. Intrinsic builtins implementation approach for 16, 32, and 64-bit integers suggested by several reviewers, and by David Stone, who provided his Boost licensed macro implementation that became the starting point for boost/endian/detail/intrinsic.hpp. Pierre Talbot provided the int8_t endian_reverse() and templated