3 ms·
Re: Start Enums at One. As explained, it is to avoid making the first enum value the default when making it the default is not appropriate.
by sanxiyn 7y ago
Re: Start Enums at One. As explained, it is to avoid making the first enum value the default when making it the default is not appropriate.
- gen220 7y agoAt my place of work, we pretty much always make the default (0) value “Unspecified”. The rationale is, it’s often quite useful to know that the originator hasn’t specified a value, and to help new originators avoid unintended side-effects. This style guide has the same effect, but it’s implicit; takes a few more mental cycles to parse in exchange for less code. Personally, I think it’s probably worth the trade off to type it out once and save time thinking later.