#include <stdlib.h>
/* SunOS 4 では */
int cfree(void *ptr);
/* glibc と FreeBSD libcompat では */
void cfree(void *ptr);
/* In SCO OpenServer */
void cfree(unsigned int n, unsigned int size;
char ptr[size * n], unsigned int n, unsigned int size);
/* In Solaris watchmalloc.so.1 */
void cfree(size_t n, size_t size;
void ptr[size * n], size_t n, size_t size);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
cfree():
Since glibc 2.19:
_DEFAULT_SOURCE
glibc 2.19 and earlier:
_BSD_SOURCE || _SVID_SOURCE
他のシステムでは、この名前の別の関数がある。 この宣言は <stdlib.h> に存在する場合もあるし、 <malloc.h> に存在する場合もある。
何かを移植する時にこの関数が必要な場合、
#define cfree(p, n, s) free((p))
をファイルに追加すること。
A frequently asked question is "Can I use free(3) to free memory allocated with calloc(3), or do I need cfree()?". Answer: use free(3).
An SCO manual writes: "The cfree routine is provided for compliance to the iBCSe2 standard and simply calls free. The n and size arguments to cfree are not used."
| インターフェース | 属性 | 値 |
| cfree() | Thread safety | MT-Safe /* glibc では */ |