[GRASS-dev] The "nature" of size_t
damiano.triglione at polimi.it
Tue Mar 27 13:07:55 CEST 2007
I presumed it expected a signed integer, because if I invoke it with an
unisgned int parameter, I have a warning:
warning: passing arg 1 of `G_calloc' as signed due to prototype
even if I did not redefine G_calloc anywhere.
Thus, do you think that if I declare in my file
G_calloc(unsigned int, unsigned int);
I can then eliminate the warning, instead of using a cast in every
----- Original Message -----
From: "Wolf Bergenheim" <wolf+grass at bergenheim.net>
To: "Damiano Triglione" <damiano.triglione at polimi.it>
Cc: <grass-dev at grass.itc.it>
Sent: Tuesday, March 27, 2007 12:31 PM
Subject: Re: [GRASS-dev] The "nature" of size_t
> What? No it doesn't. How do you figure it expects a signed integer?
> The definition of G_calloc doesn't have anything to do with how the
> compiler thinks it is. Have you redefined G_calloc somewhere? If you
> declare in your own file G_calloc(unsigned int, unsigned int); Then the
> compiler will think that G_calloc expects two unsigned integers, no
> matter how it is really in alloc.c, since the compiler will not look in
> alloc.c when compiling your stuff.
> On 27.03.2007 12:42, Damiano Triglione wrote:
>> I am still trying to understand the "nature" of size_t.
>> If I am not wrong, it is equivalent to the unsigned integral type of the
>> result of "sizeof". E.g. in my 32-bit processor PC, it is equal to 4.
>> But G_calloc() expects - as first argument - a SIGNED (not unsigned)
>> parameter, even if in alloc.c I find that the first argument of G_calloc
>> has type size_t !
>> Can anyone, please, help me tu figure out?
>> grass-dev mailing list
>> grass-dev at grass.itc.it
> <:3 )---- Wolf Bergenheim ----( 8:>
More information about the grass-dev