This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: malloc returns int?
- To: John Giffin <gif at Henson dot sandstorm dot net>
- Subject: Re: malloc returns int?
- From: Michael Poole <poole at troilus dot org>
- Date: 25 Jul 2000 14:54:31 -0400
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <200007251847.OAA10569@Henson.sandstorm.net>
Your program is buggy. There is no prototype of malloc() in your
code, so gcc must assume that it is a function returning int.
John Giffin <gif@Henson.sandstorm.net> writes:
> using gcc v 2.95.2 on a freeBSD box,
> this program:
>
> main()
> {
> void *bar = malloc(10);
> }
>
> returns this warning when compiled:
> point.c: In function `main':
> point.c:3: warning: initialization makes pointer from integer without a cast
>
> malloc should be returning void *, not int, yes?