ok@quintus (Richard A. O'Keefe) (10/04/88)
Not too long ago, there was a Fortran-vs-C dispute in comp.lang.fortran. One of the sub-topics was pointers, and at least one of the people arguing on the Fortran side claimed that malloc() and free() were not part of C, just part of the UNIX C library. Now, malloc() and free() _are_ part of the ANSI C draft and have been from its beginnings. But oddly enough, when I checked The Book, the claim above turned out to be half true. "The C Programming Language", Kernighan & Ritchie, 1978, does not list malloc() in its index, and while free() does appear, the references are to two different functions. But in Chapter 7 says Finally, the routines are meant to be "portable", in the sense that they will exist in compatible form on any system where C exists, and that programs which confine their system interactions to facilities provided by the standard library can be moved from one system to another essentially without change. (p143) and in the section "Storage Management" (p157) describes calloc(n, sizeof(object)) cfree(p) So any system which does not have calloc() or cfree() is, in the words of The Book, not a "system where C exists", and memory management _has_ been a required part of C (even if the compiler didn't need to treat these functions specially).
gwyn@smoke.ARPA (Doug Gwyn ) (10/05/88)
If it had been obvious what was and wasn't C, there would have been little reason to develop a C standard! Certainly malloc() and free() are part of C now. Arguing about whether they "really" were in 1978 is pointless.