Perhaps the most important reason is the lack of prior art. There are very few examples of functions added to the C standard committee that were not popular extensions before and are not needed to write strictly appropriate code.
There is some vague "spirit C", an explanation of C99 (V5.10) reads (p. 3, above):
Some of the aspects of C can be summarized in phrases such as:
- Trust the programmer.
- Do not let the programmer do what needs to be done.
- Keep your tongue small and simple.
- Provide only one way to perform the operation.
- Do it quickly, even if it is not guaranteed to carry over.
In addition, C tries to remain backward compatible with older versions; For example, old-style ads were marked obsolete in C89, but are still part of C11. Ibid., P. 2:
Existing code is important; there are no existing implementations. There is a large array of C code of significant commercial value. Every attempt has been made to ensure that the bulk of this code is acceptable for any implementation that conforms to the standard. The C89 committee did not want to force most programmers to modify their C programs only to be accepted with the help of an appropriate translator.
Some differences in C and C ++ are at least partially caused by function overloading, for example, the type of character constants:
int foo(int); int foo(char); ... foo('x');
In C ++, this calls foo(char) , but in C the type 'x' is int , so either the result will be quite unexpected, or 'x' should be of type char , possibly breaking existing code. In addition, you probably need some promotions where they make sense, for example. if the second declaration foo was not declared in the last example, then 'x' would be upgraded to int and foo(int) . Such rules can become complex in detail (if void * implicitly converted to function calls?). (Not a hard number, but the chapter on function overloading in the C ++ standard (chapter 13) in the n3797 project covers about 30 pages, the ibid 5.2.2 chapter on function calls is much longer than the corresponding standard part C.)
Virtually every C feature is needed for a minimal language (well, modulo historical heritage), very little syntactic sugar; such an overload of functions may be considered (you could name your functions foo_int and foo_char , etc. and call them correctly).
The reasons you suggested are circular (and therefore not applicable): C used some C ++ functions (for example, function prototypes); and function overloading was introduced in C ++ because C was missing it (you cannot say: "This is not part of C because it is part of C ++, but part of C ++ because it is not part of C" ) The same goes for the second sentence on C and OOP.
What I personally like about C is that it pretty closely matches the machine. It is often easy to see how the assembler assembly generated by the C code relates to it. The names of the characters are unrelated and can be easily identified. The language remains simple and minimal. Honestly, I donβt understand what people after, when they want to see some of the C ++ functions included in C: we have C ++, a language that offers these things, with the ability to write efficient code for a specific platform; why not just use it?
C11 introduced _Generic , which may interest you.