2009-12-22 03:12 AM
COSMIC Type Cast Problem
2011-05-17 06:06 AM
We have 2 issues during using COSMIC Compiler 4.3.1 16k Limit version and STVD 4.1.3, R-Link.
First, we don’t have functional value through using Local Variable, when we use as above it shows different value on long_var. void main(void) { long long_var = 0; float float_var = 0; long_var = 533485489; float_var = (float)long_var; while (1) { } }http://www.insem.co.kr/100201/1_local.gif
Second, Type Casting problem. long long_var = 533485489; float float_var = 0; void main(void) { float_var = (float)long_var; while (1) { } } It showed wrong value on float_var as it was inserted Type Casting after we declared global variable, however, it goes properly in main function as follows. long long_var; float float_var = 0; void main(void) { long_var = 533485489; float_var = (float)long_var; while (1) { } } We think it has a problem, isn’t it?2011-05-17 06:06 AM
Hi,
The setting Display Item from Decimal on Standard in debuger solved the problem. Regards Kris.2011-05-17 06:06 AM
also, when you work with local variables that are not actually used for anything, the compiler sometimes optimize them out: use globals or, at least, declare the locals volatile, to avoid this.