[GRASS-dev] The "nature" of size_t

Damiano Triglione damiano.triglione at polimi.it
Tue Mar 27 08:12:20 EDT 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?
Damiano

----- 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 
> int.
>
> 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.
>
> --Wolf
>
> On 27.03.2007 14:07, Damiano Triglione wrote:
>> Thanks!
>> 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
>> invocation?
>>
>> Damiano
>>
>> ----- 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.
>>>
>>> --Wolf
>>>
>>> On 27.03.2007 12:42, Damiano Triglione wrote:
>>>> Hi,
>>>> 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?
>>>> Thanks,
>>>> Damiano
>>>> _______________________________________________
>>>> grass-dev mailing list
>>>> grass-dev at grass.itc.it
>>>> http://grass.itc.it/mailman/listinfo/grass-dev
>>>
>>> -- 
>>>
>>> <:3 )---- Wolf Bergenheim ----( 8:>
>>>
>>
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at grass.itc.it
>> http://grass.itc.it/mailman/listinfo/grass-dev
>
> -- 
>
> <:3 )---- Wolf Bergenheim ----( 8:>
> 




More information about the grass-dev mailing list