I'm using Microvision 4 C compiler Armcc.Exe v4.0.0.524 When this compiler converts a floating point number (single precision) to INT8 it doesn't handle negative values properly. For example INT8 Function::Convertnumber(F32 number) { INT8 return; return = number; }
this only works for positive numbers. If a negative value is passed into the function 0 is returned only. Seems like a bug in the compiler. I can't find any errata concerning this but i'm wondering if anyone else has noticed this problem and how it was solved?
It illustrates a number of problems - but not the one you're claiming.
You specifically stated the C compiler - but the example is not valid C !
If you want it to be interpreted as C++, you need to ensure that you correctly inform the Compiler...
But return is a keyword in both C and C++ - so can't be used as a symbol name in either.
en.cppreference.com/.../keyword
www.catb.org/.../smart-questions.html
"I'm using optimization level 3 which I believe might be part of the issue"
Indeed - since the value of 'return' (sic) is never used, it really doesn't matter what the value is at all!
"It illustrates a number of problems - but not the one you're claiming."
Oh yes, it's almost like the code is using a mix of C, C++ and something like Delphi?
DJR
could it have something to do with "Target Options" Tab C/C++ "plain char is signed" default is passiv?
Werner