Re: [AD] int vs long

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Evert Glebbeek wrote:
Allegro currently assumes that int and long are both 32 bit in length. It seems that it's safer to assume that int is 32 bit than that long is, so I've made a small preliminary patch (long_int.diff) that replaces long with int in places where I think this matters. I haven't made a lot of work of this yet, so it's certainly incomplete. While not a complete solution, it would help for 4.2 anyway.

I think there's a problem with this:
-   unsigned long sx, sy, dx, dy;
+   unsigned int sx, sy, dx, dy;

IIRC, bmp_write_line returns a pointer to the data, which can be >32 bits on 64-bit platforms, through an unsigned long. This is going to be interesting to handle in case of int and long both being less than a pointer's size (MSVC).


maybe a packf_puti8 should replace packf_putc, but here I'm less certain.

It probably should. There are places where Allegro says a character may not be one byte (in the case of certain text modes), so I think it's best to remove all ambiguity.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/