News for hackers. Stuff that matters.
Re:Nomad drained of $150m due to a coding mistake by klodolph on Tuesday August 02, 2022 @03:06PM (#32322938)
Unlikely. The way it works is you define your enums like this:

  enum class Color {
    Invalid, // Not a valid value.
    Red,
    Orange,
    Yellow,
    Green,
  };
I think if someone's crazy enough to reclaim a 0 value in an enum or integer ID, then they're probably going to do a lot of damage to the code no matter what you do.
Re:Nomad drained of $150m due to a coding mistake by benreesman on Tuesday August 02, 2022 @06:17PM (#32324972)
Yeah, pretty much every integer enum I write has `UNKNOWN` or `INVALID` as the zero value. It adds either a `case` or a `default` to every switch and a clause or a `_` to every `match`, but it saves my ass even in non-security-sensitive settings.