3 ms·
Make this construct legal behavior without making it 10x slower than clang/gcc are today: void wat(uint16_t *x, uint16_t *y) { *x = *y; } uint64_t a
by xenadu02 8y ago
Make this construct legal behavior without making it 10x slower than clang/gcc are today:
void wat(uint16_t *x, uint16_t *y) {
*x = *y;
}
uint64_t a[100] = { 0 };
wat((uint16_t *)&a[0], (uint16_t *)(((char *)&a[0]) + 1));
When you think you've figured that one out, try this one:
uint16_t heh = 0xFFFF;
extern uint16_t doesAnything(uint16_t *, uint16_t *);
void wat(uint16_t *x, uint16_t *y) {
*x = *y + doesAnything(&heh, y);
}
uint64_t a[2] = { 0 };
wat((uint16_t *)&a[0], (uint16_t *)(((char *)&a[0]) + 1));
- AstralStorm 8y agoMissing the point. Linus was talking about union aliasing.