문제

What is the most reliable way to detect whether the architecture uses one's or two's complement representation in C++?

도움이 되었습니까?

해결책

You shouldn't have to worry - there aren't too many ones complement machines out there :)

But the easiest thing might be to compare "-1" with ~0.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top