Skip to content

Commit

Permalink
mdbx++: clarify comments for mdbx::byte and char8_t usage.
Browse files Browse the repository at this point in the history
Related to #263.
  • Loading branch information
erthink committed Jan 21, 2022
1 parent 75b2352 commit 03381fa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mdbx.h++
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,15 @@ namespace mdbx {
// Functions whose signature depends on the `mdbx::byte` type
// must be strictly defined as inline!
#if defined(DOXYGEN) || (defined(__cpp_char8_t) && __cpp_char8_t >= 201811)
// Wanna using a non-aliasing type to release more power of an optimizer.
// To enable all kinds of an compiler optimizations we use a byte-like type
// that don't presumes aliases for pointers as does the `char` type and its
// derivatives/typedefs.
// Please see https://github.com/erthink/libmdbx/issues/263
// for reasoning of the use of `char8_t` type and switching to `__restrict__`.
using byte = char8_t;
#else
// Wanna not using std::byte since it doesn't add features,
// but add inconvenient restrictions.
// Avoid `std::byte` since it doesn't add features but inconvenient
// restrictions.
using byte = unsigned char;
#endif /* __cpp_char8_t >= 201811*/

Expand Down

0 comments on commit 03381fa

Please sign in to comment.