Does using const global vars instead of enum ensure ABI compatibility?
<p>In a C library project of mine I have an enum that lists all possible types a piece of data handled by the library can be:</p>

<pre><code>// lib.h
enum types {
    VOID,
    INT,
    FLOAT,
    CONST_INT,
    CONST_FLOAT
}
</code></pre>

<p>The code will be compiled into a shared library. In future versions of the library, I will be required to insert new entries into the enum and reorder existing ones. AFAIK this breaks ABI compatibility since the enum is not transformed into a set of symbols that ends up in the library, but rather causes whatever integer the compiler assigns to each entry to be hardcoded. Is that the case?</p>

<p>If so, would it be preferable to instead use constant global variables such that they make an appearance in the symbol table and I thus can change both order and the value assigned to each?</p>

<pre><code>// lib.c
const int VOID = 1;
const int INT = 2;
const int FLOAT = 3;
const int CONST_INT = 4;
const int CONST_FLOAT = 5;

// lib.h
extern const int VOID;
extern const int INT;
extern const int FLOAT;
extern const int CONST_INT;
extern const int CONST_FLOAT;
</code></pre>