malloc 랩핑 함수에 대하여..
글쓴이: upersbird / 작성시간: 금, 2013/05/31 - 10:57오전
#define _ALLOC(size) alloc_body(size, __func__)
void *alloc_body(size_t size, const char *log)
{
void *ret;
ret = malloc(size);
if(!ret)
{
printf("memory allocation error!\n");
return NULL;
}
return ret;
}
...
char *buf = NULL;
buf = _ALLOC(100);
...이때, 컴파일을 하면
warning: cast to pointer from integer of different size
위와 같은 경고가 뜨는데, 자료형을 바꾸고 캐스팅을 다르게 해봐도 안되네요..
이거 참 질문도 허허;;
Forums:


아..그리고..
buf = malloc(100); 으로 변경하면 또 경고가 없네요 허허...
size_t 대신에 int 를 쓰면 될까요?
size_t 대신에 int 를 쓰면 될까요?
댓글 달기