| ??? 03/05/10 14:12 Read: times |
#173880 - It's too easy Responding to: ???'s previous message |
You cannot rely on all variables to be initialised by startup code.
If you try to remember which ones are, and which are not, initialised by the startup code - sooner or later you will get it wrong. Hence the safest rule is to insist that all variables must be explicitly iniialised (or assigned a vlaue) before use.
void my_function( void )
{
u8 uninitilised;
u8 initialised = 0;
u8 assigned;
:
assigned = something;
// now we can safely do stuff that reads 'assigned'...
} |



