3 ms·
The example code used added “other” as the last option, which was the source of the problems he described. This doesn’t happen when you make the first value in
by jmole 2y ago
The example code used added “other” as the last option, which was the source of the problems he described.
This doesn’t happen when you make the first value in the enum unknown/unspecified
- plorkyeran 2y agoNo, the problem described in the article is entirely unrelated to where in the enum the Other option is located. There is a different problem where keeping the Other option at the end of the enum changes the value of Other, but that is not the problem that the article is about.
- jmole 2y agoWell it simplifies the logic considerably - if you see an enum value you don’t recognize (mint), you treat it as uninitialized (0). So any future new flavor will be read back as ‘0’ in older versions.