Comment

Comment by MereInterest

Assuming you're working in a language that defines signed integer overflow. Depending on the language, you can result in undefined behavior, instead. For that reason, I'd go with an unsigned counter, with the first million IDs being invalid or reserved for future use. That way, you get well-defined overflow into an invalid region.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton