I had a requirement wherein I have an enum in native C++ code as [all pseudocode]:
enum Dummy {
A,
B,
MAX,
};
Now I also want to have an equivalent enum in Java code
public static enum Dummy {
A,
B,
MAX
};
Doubly defining makes things extremely brittle and error prone, subject to bouts of amnesia or indolence on part of developers. Is there some concrete way to always have them in sync. I don't want a bunch of #defines as suggested by this question.