Why does -Wcast-align not warn about cast from char* to int* on x86?
问题 I understand that gcc has an option -Wcast-align which warns whenever a pointer is cast such that the required alignment of the target is increased. Here's my program: char data[10]; int ptr = *((int *)data); On my machine, the alignment requirement of data is 1 whereas it's 8 for ptr. Why don't I get a warning? Could it be because I'm compiling it for x86? 回答1: The warning will never be emitted when compiling for Linux i386 or x86-64, when using the standard ABIs for these systems. Let me