Tidier Tables in “C” via Macros
Great article titled Reduce C-language coding errors with X macros outlines a way to use the C Preprocessor to create tidier tables. Highly recommended reading for those of you who like data-driven solutions.
How many times have you used a “table” in C code? Data-driven approaches are great, but often require you to manually keep table data in sync in multiple places in your code. It’s a common maintenance issue in “C”. This article describes ways to make the Preprocessor to do more of the work for you. The result is fewer bugs and reduced workload when you update your tables. The cost may be slightly lower readability for less experienced programmers.
Whether you chose to use this technique or not, you owe it to yourself to at least check it out.