Hacker News new | ask | show | jobs
by ergothus 2575 days ago
Generally developers tend to either (1) misunderstand them when they encounter them in the wild or (2) accidentally invoke them. (I believe multiple languages have had issues with '04' being treated as an octal, which works fine and doesn't trigger developer notice until they encounter '09' in the wild).

Whether these are VALID concerns I won't take a stance on - just saying these are the reasons I've seen cited.

1 comments

Why not use 0x,0b, and 0o for hex, binary, and octal literals? I never liked the fact that a number starting with 0 was treated as octal.
OCaml does just that; it might have been the first language to have 0b and 0o prefixes for binary and octal literals.

https://discuss.ocaml.org/t/the-origin-of-the-0b-01-notation...