This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author petr.viktorin
Recipients petr.viktorin
Date 2021-07-23.15:23:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1627053817.9.0.30877505306.issue44727@roundup.psfhosted.org>
In-reply-to
Content
Adding a new enumerator to a C enum can change the size of the type,
which would break the ABI.
This is not often a problem in practice, but the rules around when it is a problem and when it isn't are complicated enough that I believe enum should not be used in the stable ABI (possibly with well-reasoned exceptions)

AFAICS, the rules are:
- In C++, an incompatible change to an enum is one that changes the size of the *smallest bit field large enough to hold all enumerators*. Values outside the range cause undefined/unspecified behavior.
- In C, it looks like enums that fit in `char` are safe.

(Also, the compiler-defined size of enums will make it more cumbersome to formally define an ABI for non-C languages.)
History
Date User Action Args
2021-07-23 15:23:37petr.viktorinsetrecipients: + petr.viktorin
2021-07-23 15:23:37petr.viktorinsetmessageid: <1627053817.9.0.30877505306.issue44727@roundup.psfhosted.org>
2021-07-23 15:23:37petr.viktorinlinkissue44727 messages
2021-07-23 15:23:37petr.viktorincreate