Re: xcalloc question

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 17 Oct 2001 03:30:53 +0200

Adrian Chadd wrote:

> Oh, I gather that the end result is the same, since calloc is just
> allocing an array of the given size. I just thought it may be a bit
> weird (and it generates type warnings too :-)

What type warning do you get?

> Would you mind if for the sake of conformity I reverted the arguments?

Should not make any difference. If the warning is correct it should
still be there.

Investigating... ah, the definition of xcalloc is a bit odd. Both
arguments should be size_t as it is supposed to match calloc(), but as
written the first argument is an int. This makes a difference as int is
signed but size_t is unsigned. Wonder why you did not get a warning on
this in lib/util.c:xmalloc() (you should, if you get a warning on this
odd usage of xcalloc()).

Regards
Henrik
Received on Tue Oct 16 2001 - 19:30:02 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:33 MST