There are a lot of options that you probably will not use :-)
One example is when you want to include debug code in your code like :
const cdebug=1
#if cdebug
print "started"
#endif
here goes some actual code
#if cdebug
print "other debug info"
#endif
if you compile with cdebug=1 all the PRINT statements will be included in the code.
if your code works, you just set : cdebug=0
and recompile the code.
Now it will not include the PRINT statements.
Or imagine you start witha product that has this code :
config portB=output
but then you migrate to a new chip with more pins and you use a different port.
if you need to maintain both software it is simpler to do this:
const model=0
#if model=0
config portb=output
led alias portb.0
#else
config portc=output
led alias portc.0
#endif
↧