== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > Walter's counter-argument is that 2's complement > arithmetic is an inescapable reality that all coders must be aware of in > D and its kin. Negation is really taking the two's complement of the > thing. The fact that the type was unsigned is not of much import. > Andrei
Ok, but you could still do it just by using an explicit cast. When you're thinking of how things are represented at the bit level, this is basically type punning. It should be allowed in a systems language, but it should require an explicit cast. Using unary - to get the two's complement of a number is a way of getting around they type system and is probably a bug more often than an intentional idiom.