Frage

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

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top