Hi,In response to the original post; you're expecting the language to do too much for you. C is a lower level language, and memset() is a very old C function. What you get is exactly what you see.
void *memset(void *s, int c, size_t n);
It sets "n" bytes of memory, starting at the address specified by "s" to the value specified by "c", and returns the value of s. That's all it does, no more no less. It works exactly as the man page describes.
Well i would hope the documentation is correct
You realize what you said is true but that it does not strictly speaking require an "int" in the argument "int c". That is because memset can not set "ints" it can only set bytes (or as we take them to be sometimes which is chars or uchars).
THAT is what is causing the confusion i am seeing on the web in various places. People see the prototype and then misinterpret the int to mean you can set int's when you cant.
As i said before, if we HAD to use an 'int' in every function definition then we would never be able to pass a char such as:
void MyFunc(char c)
we would be forced to do:
void MyFunc(int c).
The reason the form void MyFunc(char c) is valid is because first and foremost we are allowed to do that, and second because any extra stack time does not add significantly to most function calls because the body takes much more time than the call itself. This is well known, and when it does not apply the function is used inline.
But im still open to other arguments.