Compile-time lookup array creation for ANSI-C?

Posted by multiproximus on Stack Overflow See other posts from Stack Overflow or by multiproximus
Published on 2010-03-18T17:09:58Z Indexed on 2010/03/18 17:31 UTC
Read the original article Hit count: 518

A previous programmer preferred to generate large lookup tables (arrays of constants) to save runtime CPU cycles rather than calculating values on the fly. He did this by creating custom Visual C++ projects that were unique for each individual lookup table... which generate array files that are then #included into a completely separate ANSI-C micro-controller (Renesas) project.

This approach is fine for his original calculation assumptions, but has become tedious when the input parameters need to be modified, requiring me to recompile all of the Visual C++ projects and re-import those files into the ANSI-C project. What I would like to do is port the Visual C++ source directly into the ANSI-C microcontroller project and let the compiler create the array tables.

So, my question is: Can ANSI-C compilers compute and generate lookup arrays during compile time? And if so, how should I go about it?

Thanks in advance for your help!

© Stack Overflow or respective owner

Related posts about c

    Related posts about ansi-c