Search code examples
c++ccompiler-errorscompilationiar

IAR C compiler switch : Quick query


I am using IAR compiler, and have some Compile switches in the code.

When I switch between 2 different #defines does the other code which was not selected still be present in the final Hex file generated?


Solution

  • The preprocessor just does dumb cut'n'paste and it runs before the compiler. Any code (text, really) that it excludes will not be part of the source the compiler sees, so obviously it won't make it into the final object file/library/executable either.

    In short, the answer to your question is "no". But, if you don't believe me, just check the final generated file.