[Gambas-user] unsigned int datatype for external function

Tobias Boege taboege at gmail.com
Sun Jun 10 20:00:09 CEST 2018


On Sun, 10 Jun 2018, Jussi Lahtinen wrote:
> > An integer type is obviously not wide enough.
> >
> 
> It is. You need 32 bits and Gambas integer is 32 bits. Gambas just
> interprets/displays the most significant bit as sign bit.
> 

I believe the C standard leaves the width of size_t open. When it speaks
about "an unsigned integer type", that does not necessarily mean it's
*the* "unsigned int" of which we could maybe expect that it's 32 bits wide.

FWIW, on my system, size_t is 64 bits wide, like unsigned long and unlike
unsigned int:

  $ echo -e '#include <stdio.h> \n #include <stddef.h> \n int main(void) { printf("%u\\n", sizeof(size_t)); }' | gcc -x c - && ./a.out
  8

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list