11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVRSupported DirectivesLong definitions can be broken into separate lines by using <strong>the</strong> line-continuationcharacter backslash at <strong>the</strong> end of <strong>the</strong> unfinished line.Macro Definition #define macname definitionA simple macro definition. All references to macname will be replaced by itsdefinition. #define macname(arg [,args]) definitionA function-like macro, allowing arguments to be passed to <strong>the</strong> macro definition. #undef macnameUndefine macname as a macro. Useful <strong>for</strong> later on redefining macname to ano<strong>the</strong>rdefinition.C99 allows variable arguments in a function-like macro definition.Conditional ProcessingIn conditional processing directives (#if/#ifdef/#elif/#else/#endif), a linegroup refers to <strong>the</strong> lines between <strong>the</strong> directive <strong>and</strong> <strong>the</strong> next conditional processingdirective. Conditional directives must be well <strong>for</strong>med. For example, #else, if it exists,must be <strong>the</strong> last directive of <strong>the</strong> chain be<strong>for</strong>e <strong>the</strong> #endif. A sequence of conditionaldirectives <strong>for</strong>m a group, <strong>and</strong> groups of conditional directives can be nested. defined(name)Can only be used within <strong>the</strong> #if expression. Evaluate to 1 if name is a macroname <strong>and</strong> 0 o<strong>the</strong>rwise. #if Conditionally process <strong>the</strong> line group if evaluates to non-zero. may contain arithmetic/logical operators <strong>and</strong> defined(name). However, since<strong>the</strong> C preprocessor is separate from <strong>the</strong> C <strong>compiler</strong> proper, it cannot contain <strong>the</strong>sizeof or typecast operators. #ifdef name / #ifndef nameA shorth<strong>and</strong> <strong>for</strong> #if defined(name) <strong>and</strong> #if !defined(name),respectively. #elif 68

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!