Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The strict aliasing violation is incidental. You can change int8_t to char in the code and get the same result with no strict aliasing violation.


Sure, as per my other comment, it then would be an object representation violation.

Even ignoring both rules, there is still no reason to expect the assertion not to fire:

    int x = 2;
    assert(*(bool*)x == true);
This is the same as:

    float x = 2.0
    assert(*(int*)x == 2);
Just because two object are convertible, there is no reason to expect their representation to be the same.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: