-fno-strict-aliasing is so silly, people seem like scared of strict aliasing somehow
like is it that hard to understand the concept of “don’t access some object as a different type unless it’s char *“?
-fno-strict-aliasing is so silly, people seem like scared of strict aliasing somehow
like is it that hard to understand the concept of “don’t access some object as a different type unless it’s char *“?
(my_struct *) (char *) xxx valid then?(String) (Object) Integer.valueOf(1)@lina java works differently than c, likely it’s doing actual conversions here
to which, with non-pointer types in c, e.g. a (double) or (int) cast, it would do the conversions – strict aliasing rules only apply to pointer types because the compiler (rightfully) is allowed to consider two memory regions (pointers) of different types as always being different objects
likely it's doing actual conversions here
it's not, actually! that piece of code will error at runtime with a ClassCastException because Integer is not a subclass of String. the cast only works because you're allowed to cast down to an ancestor (and Object is the shared ancestor for everything), and to cast up from an ancestor to a derived type -- that is the part that might error out at runtime