Keith said:
It signals an octal base in a literal in C source code. It's not
obvious that user input should have the same syntax as program source
code.
While that is true in general, the practice harks back to
(at latest) responses to interactive prompts from DEC SYSGEN
programs, where the radix for input was under control of
the person entering the data, using 0 prefix for octal.
... if the
program is going to be used only by its author or by fellow
programmers, being able to use octal and hexadecimal input can be
quite handy.
Yes, that was the idea. A size, for example, might be
thought of in decimal or in some binary-related readix,
depending on how it was obtained.
In a similar vein, there are programs such as Unix "dd"
where sizes can be specified in bytes, "blocks", "Kbytes",
etc. through use of suffixes.
And of course as far back as early Fortran, numeric input
was allowed to optionally be expressed in a form of
"scientific notation".
Whether these are good ideas or not depends on many factors,
and is not something that the C standard is in a position to
determine.