Question

Possible Duplicate:
At least the first 31 ,or 63 characters of an internal name are significant?

Here's a direct quote from the Book (K&R, 2nd ed, p. 35):

"At least the first 31 characters of an internal name are significant. For function names and external variables, the number may be less than 31, because external names may be used by assemblers and loaders over which the language has no control. For external names, the standard guarantees only for 6 characters and a single case."

and in c99 there is no length limitation on its internal names, but only the first 63 are significant.

My question is why are these limits specifically 31 or 63? Why this number specifically why not 19,24 or any other number? If it's an implementation issue, is there a benefit from making it 31 or 63?

Was it helpful?

Solution

It's so the length can be a power of two, even including NUL-termination.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top