K
Keith Thompson
Rod Pemberton said:'int' is a type-specifier. 'void' is a type-specifier. 'void main' has
'void' used as a type-specifier instead of 'int' as a type-specifier. So,
the key issue is how was 'void' used as a type-specifier _before_ (i.e.,
from 1979-80) it was standardized as part of the C language. As I
indicated, 1) 'void', on compilers that didn't supply it, was defined to a
valid type-specifier, usually 'int' and 2) it was added to an important Unix
compiler of the era PCC. If programmers of the era understood that 'void'
was usually an alias for 'int', it wouldn't be an ignorant use, would it?
It would only be ignorant if they continued to use it long after C90.
Programmers of that era would have understood that "void", when used
as a return type, indicates that the function doesn't return a value,
but that the word could be aliased to "int" for compilers that didn't
yet directly support "void".
Declaring
void main()
is and was no more sensible than declaring
void n = 42;
The usual way to declare main back in the old days was simply:
main()
which was used in the examples in K&R1.