Is 0 a decimal literal or an octal literal?

Zero is always zero, so it doesn’t matter. But in a recent discussion with a friend he said that octal literals are almost unused today. Then it dawned upon me that actually almost all integer literals in my code are octal, namely 0.

Is 0 an octal literal according to the C++ grammar? What does the standard say?

The only real use I’m aware of is for unix file permissions.

3 Answers
3

Leave a Comment