I have an application which needs to define indexes in various .h files in a hierarchical manner. There is a large set of common entries in a single file and a number of variant header files that are pulled in to specific projects.
In file: “base.h”
#define AAA 1
#define BBB 2
#define CCC 3
In many files like: “variant_extended.h”
#define XXX 4
#define YYY 5
#define ZZZ 6
However, this is cumbersome, is there a simple way to carry on from base.h and auto-number the defines in the build process?
I am frequently editing the files to reorder or insert new entries which leads to a lot of manual management. I need to also, ensure the numbers start at 0 and are contiguous. These will be indexes in an array (like mailboxes).
To expand on Jerry’s comment:
In this case, ZZZ is guaranteed to be 6. Insert new members into the enums automatically renumbers all the other members.