Category "strict-aliasing"

Why are the results of the optimization on aliasing different for char* and std::string&?

void f1(int* count, char* str) { for (int i = 0; i < *count; ++i) str[i] = 0; } void f2(int* count, char8_t* str) { for (int i = 0; i < *count; ++i)

accessing long double bit representation

TLDR; Does the following code invoke undefined (or unspecified) behaviour ? #include <stdio.h> #include <string.h> void printme(void *c, size_t n

What is the no-undefined-behavior way of deserializing an object from a byte array in C++11 (or later)?

To overcome alignment issues, I need to memcpy into a temporary. What type should that temporary be? gcc complains that the following reinterpret_cast will br