Can an int be aliased as an unsigned int? [duplicate]
问题 This question already has answers here : Writing to a signed integer as if it is unsigned in C++ (2 answers) Efficient way to bit-copy a signed integer to an unsigned integer (4 answers) Closed 3 years ago . Compiler generates code assuming that an int can be aliased by an unsigned int . The folowing code: int f(int& a, unsigned int& b){ a=10; b=12; return a; } int f(int& a, double& b){ a=10; b=12; return a; } generates the folowing assembly, using Clang5 (similar code is produced by GCC or