This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

STL numeric_limits is_signed do not work

Other Parts Discussed in Thread: OMAPL138

I tested the following STL instructions on an ARM (TMS470: OMAPL138)

bool sig1=std::numeric_limits<unsigned char>::is_signed;
bool sig2=std::numeric_limits<char>::is_signed;

Unfortunately both return false.

Is this a known issue? Is there a solution?

  • I found out there seems to be a difference between "signed char" and "char".

    bool sig1=std::numeric_limits<unsigned char>::is_signed;
    bool sig2=std::numeric_limits<signed char>::is_signed;

    sig1 returns false.
    sig2 returns true.

    I always thought char is signed by default?

  • It is implementation-defined whether "plain" char is signed or unsigned.

    For ARM, it defaults to unsigned.  You can change this behavior with the option --plain_char=signed, but this will create object files that are not compatible with unsigned plain char.  You should probably stick to the default.