[Gambas-user] unsigned int datatype for external function
Jussi Lahtinen
jussi.lahtinen at gmail.com
Sun Jun 10 20:13:04 CEST 2018
Very good point. However, the OP gave the expected range, which is for 32
bits.
Jussi
On Sun, Jun 10, 2018 at 9:00 PM, Tobias Boege <taboege at gmail.com> wrote:
> 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
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180610/3b859b46/attachment.html>
More information about the User
mailing list