Quote:
|
Originally Posted by Mike Betts
2 issues here...
You are doing an implicit initialization. Never a good idea in an embedded system.
Make it:
int InitFoo;
for your declaration and then
InitFoo = (100 * 5);
in your initialization routine.
Secondly (IMHO), you really do not want to do floating point... I have posted about this in other threads.
Good luck.
|
The initialization looks pretty explicit to me.
Also, why waste code space and start up time
doing math the compiler can do.
The wacky behavior is a feature, where C18 intentionally departs from ISO standard behavior
for efficiency reasons. See section 2.7.1 of the C18 users guide.
To change the behavior, use the -Oi command line option, which can be set in MPLAB under Project->Build Options->Project->(tab)MPLAB C18->(check)Enable Integer Promotions.
John