-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Closed
Labels
Description
Currently pb3 applies c98 enum scoping rule for enums. This is inconvenient when we need same Identifier in different enums. I hope there will be an new option for enums as follow:
enum Status {
option scoped = true;
START = 0;
STOP = 1;
PAUSE = 2;
}
enum Action {
option scoped = true;
NOP = 0;
START = 1; // note this entry has a different value from Status::START
STOP = 2;
}
With the annotation option scoped = true
the compiler can use enum class
for C++11, providing better code, and we users will feel more comfortable to use proper identifiers for enums. And this is totally compatible with current implementation, all existing code will not be disturbed.
MaxDZ8, xaqq, mo4islona, lisyarus, orian and 23 more