Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
Filter by
Sorted by
Tagged with
Filter by Employee ID
Score of 2
2 answers
232 views

I am working in an environment which does not have access to the compiler's normal stdlib, mostly due to disabled exceptions, instead using a custom port for the same functionality. For example, ...
Score of 0
1 answer
626 views

I'm getting many errors of the following type. Clearly, Microsoft has a definition of byte that clashes with Standard C++'s definition of std::byte (after a using namespace std, that I use in ...
Score of 4
1 answer
267 views

Why were char8_t, char16_t, char32_t designed as built-in types, but std::byte was not? As per the C++ philosophy, if something can be implemented in the library, we almost always prefer doing so to ...
Score of -1
1 answer
205 views

It seems that std::byte is generally meant to replace the use of char in buffers for allocating blocks of raw memory. But I'm worried about the fact that std::byte can implicitly create objects in an ...
Score of 5
1 answer
235 views

I noticed 8 byte std::array comparisons seem to be producing assembly different from bit_casting. GCC seems to do what I expect for a char array, but clang generates an extra mov instruction (spilling ...
Score of 3
1 answer
147 views

Is there a reason, simple enough to explain to non language lawyers, why the initializations commented out fail to compile while the first one succeeds? #include <cstddef> void test() { std::...
Score of 3
1 answer
175 views

I'm struggling to understand the following line of code: if constexpr (std::is_same_v<T, bool>) { std::byte change = std::byte(static_cast<uint32_t>(in) << m_addr[1]); std::...
Score of 19
1 answer
11497 views

C++ has a lot of types that vaguely describe the same thing. Assuming that we are compiling for an architecture where a byte is 8-bit, all of the following types are vaguely similar: std::byte std::...
Score of 2
1 answer
713 views

According to the standard reference, std::is_enum_v evaluates to true for enumeration types and to false otherwise. An enumeration type starts with an enum key, i.e. either one of enum, enum class or ...
Score of 1
1 answer
379 views

The type std::byte comprises CHAR_BIT bits, and that may be more than 8. So, how do I declare a true octet in C++?
Score of 15
1 answer
1237 views

In CPP Reference it is stated that: std::byte is a distinct type that implements the concept of byte as specified in the C++ language definition. Like char and unsigned char, it can be used to access ...
Score of 5
2 answers
392 views

std::byte is defined in C++17 as: enum class byte : unsigned char {}; I'm currently stuck at using C++14, and I wonder if I add the same definition in C++14 (in some non-std namespace, along with the ...
Score of 6
0 answers
162 views

Consider an unsigned char v that goes through a series of bit-wise operations with the result stored back to v. Under the hood, it is integer promoted once, undergoes a series of operations, and the ...
Score of 5
1 answer
590 views

I really like std::byte as a distinct type that implements the concept of byte as specified in the C++ language definition. What I don't like is the fact that modern C++ compilers will produce less ...
user avatar
Score of 0
0 answers
220 views

I have a codebase with byte defined like so: typedef unsigned char byte; And this enum: enum SymbolTypes { VARIABLE_SYMBOL_TYPE = 0, IDENTIFIER_SYMBOL_TYPE = 1, STR_CONSTANT_SYMBOL_TYPE = ...

15 30 50 per page