0 is octal!
0is actually an octal, something that's probably not that widely known.
I'm currently enhancing one of my source analysis tools and have had occasion to revisit the parsing of numeric literals in C, C++, C#, D and Java. Working my way through the requisite parts of the C and C++ standards I learned that the literal
0 is actually an octal, something that's probably not that widely known.I started a thread on the subject on the ACCU General mailing list to learn more, and it appears I'm not alone in not having known this before. Only the most omniscient of the language lawyers were aware. Someone even observed the contradictory situation for those organisations that've banned octal literals: they'd have to ban literal
The practical significance of this is pretty slight. I've squibbed the decision about whether to represent all literal
0s as decimal, regardless of language, by specifying an override flag in the parse library API.
For anyone who's interested, literal
0 is interpreted, as a special-case, as decimal in D and Java; in C# it's a moot point as there are no octals.