Well, you're right. I wasn't getting it, but I've also never seen any piece of software that would treat a single leading zero as octal. That's just a recipe for disaster, and it should use 0o116 to be unambiguous
(I am a software engineer, but was assuming you meant it was hardcoded to parse as octal, not some weird auto-detect)
It's been a long time, but I'm pretty sure C treats a leading zero as octal in source code. PHP and Node definitely do. Yes, it's a bad convention. It's much worse if that's being done by a runtime function that parses user input, though. I'm pretty sure I've seen that somewhere in the past, but no idea where. Doesn't seem likely to be common.
If the input string, with leading whitespace and possible +/- signs removed, begins with 0x or 0X (a zero, followed by lowercase or uppercase X), radix is assumed to be 16 and the rest of the string is parsed as a hexadecimal number.
If the input string begins with any other value, the radix is 10 (decimal).
You seem to have missed the important phrase "in source code", as well as the entire second part of my comment discussing that runtime functions that parse user input are different.
Who tf decided that a 0 prefix means base 8 in the first place? If a time machine was invented somehow I'm going to cap that man, after the guy that created JavaScript.
I guess this is one of the reasons that some linters now scream if you don't provide base when parsing numbers. But then again good luck finding it if it happens internally. Still, I feel like a ZIP should be treated as a string even if it looks like a number.
Yep. Much like we don't treat phone numbers like a number. The rule of thumb is that if you don't do any arithmetic with it, it is not a "number" but numeric.