[GCC-XML] Error: attempt to use poisoned "calloc"

Daniel J. Lauk dj at djlauk.de
Thu Jan 19 13:01:45 EST 2006


I tried that, too.
Same error, only it complains about malloc, instead of calloc.

/path/to/file.c:123:45: error: attempt to use poisoned "malloc"

Besides, why would anyone prefer malloc to calloc? The man page says, calloc 
additionally zeroes the memory, which is a good thing, I think...
Of course you loose a little performance and if you're sure, that nothing goes 
wrong you could skip it.

I circumvent it now, by using a fixed size char[].

Regards,
DJ

Am Donnerstag, 19. Januar 2006 18:03 schrieb Brad King:
> Daniel J. Lauk wrote:
> > Hi there.
> >
> > I tried to do a <code>char *foo = calloc(bar + 1, sizeof(char));</code>
> > and that gave me this wonderful error message:
> > /path/to/file.c:123:45: error: attempt to use poisoned "calloc"
> >
> > Has anybody an idea different from using a fixed size array?
>
> GCC sources don't want anyone to use "calloc".  Use "malloc" instead:
>
> char* foo = (char*)malloc((bar+1)*sizeof(char));
>
> -Brad



More information about the gccxml mailing list