Why memory functions such as memset, memchr… are in string.h, but not in stdlib.h with another mem functions?

前端 未结 4 1195
独厮守ぢ
独厮守ぢ 2021-01-30 16:01

I wonder, why such function as:
-memset
-memmov
-memchr
-memcpy

Exist in string.h header file, but not in stdlib.h file, where there are ot

4条回答
  •  遇见更好的自我
    2021-01-30 16:33

    In Pre-Standard C, these functions were indeed defined somewhere else, but neither in stdlib.h nor in any of the other standard headers, but in memory.h. It still might exist on your system, it certainly still does on OS X (as of today).

    memory.h on OS X 10.11 (without license header):

    #include 
    

    The whole file is only #include'ing string.h, to retain backwards compatibility with Pre-Standard C programs.

提交回复
热议问题