[GRASS-dev] The "nature" of size_t
damiano.triglione at polimi.it
Tue Mar 27 14:12:20 CEST 2007
To be honest, I included "gis.h" because I am still using Grass 6.0, so - if
I am not wring - I should not use <grass/...>.
Maybe I have this kind of problem for this reason?
Do you think that in Grass 6.2.1 the prototype of G_calloc is different from
the one in Grass 6.0?
----- 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 1:32 PM
Subject: Re: [GRASS-dev] The "nature" of size_t
> You probably haven't included <grass/gis.h> which defines a prototype
> for G_calloc and friends. The compiler defaults the prototype to signed
> So be sure you have a #include <grass/gis.h> in your file where you use
> G_calloc, to get the prototype for G_calloc, and get rid of your error.
> On 27.03.2007 14:07, Damiano Triglione wrote:
>> 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
>>>> 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
>>>> 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:>
>> grass-dev mailing list
>> grass-dev at grass.itc.it
> <:3 )---- Wolf Bergenheim ----( 8:>
More information about the grass-dev