I don't really understand how any of that works. A variables sign isn't handled at runtime and is instead handled at compile-time through the typing system. Even if you can determine at runtime (which would be purely based on how the compiler treats each sign differently) it would be inefficient.
Boost.TypeTraits contains a mechanism to determine this at compile-time: http://www.boost.org/doc/libs/1_49_0/libs/type_traits/doc/html/boost_typetraits/reference/is_unsigned.html
EDIT: I love D when it comes to situations like these.
EDIT2: If you don't want to use Boost, an implementation of those mechanisms can easily be hand-made, I can explain how.
The test above is checking to see if an int is negative, not signed (assuming that the "int" type is a 32-bit 1s-complement or 2s-complement number). Of course, testing "(test < 0)" is a safer and probably smaller and/or faster way of testing for negative values.
(By definition, all "int" values are signed in C/C++).