Given this concrete example
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
int main(void)
{
uint8_t stuff[8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
int64_t bigint = *((int64_t *) stuff);
printf("bigint = %ld \n", bigint);
return 0;
}
Am I violating the C11 standard? Note that it appears to work right compiled with later gcc and clang with "-Wall -Wextra -fstrict-aliasing -std=c11", but for example gcc 6.4 will issue warnings that "dereferencing type-punned pointer will break strict-aliasing rules" which I expect from my understanding.
Off the top of my head the safe way to do this is to perform the always safe cast to a character type and memcopy. However I want to understand whether this is UB or simply implementation defined; safe to do but not portable.