]> sigrok.org Git - libsigrok.git/commit - libsigrok.h
Avoid future ABI breakage by hardcoding enum values.
authorAlexandru Gagniuc <redacted>
Fri, 2 Nov 2012 16:56:56 +0000 (11:56 -0500)
committerUwe Hermann <redacted>
Fri, 2 Nov 2012 18:00:37 +0000 (19:00 +0100)
commit24d04d1e3de61cc3f1f12c3091bf393ee2dac8de
tree41a068dd131921d06570352ebbfba07c9a0f7cea
parent83e3c368c67d6bbc86015fc47a7f7e39160b3baa
Avoid future ABI breakage by hardcoding enum values.

Whenever we added a field to the enums in libsigrok.h, we were running
the risk of breaking ABI compatibility. Any reordering of existing values
or the addition of entries other than at the bottom of the list would
cause an ABI breakage.

By hardcoding the values we ensure that any added field will have an
unused value, and will not take a value previously used by a different
flag. By doing this, we avoid confusing frontends compiled with an
earlier API.

We use 10000 as the first entry of each enum, and each "category" gets
an explicit number (10000, 20000, 30000, and so on).

Also avoid making the first value of an enum zero. A value of zero is
used as terminator item in some lists.

Remove explicit "DUMMY" (terminator) enum entries, they're not needed.

Signed-off-by: Alexandru Gagniuc <redacted>
libsigrok.h