Re: [AD] int vs long

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


On Thu, 2005-01-06 at 13:01 +0100, 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.

Makes sense. Where do we actually need "long" at all? And for after 4.2,
I think we should switch to the C99 types (int32_t int64_t).

> The second patch (file_inttypes) deprecates packf_[i|m][put|get][w|l]  in 
> favour of packf_[i|m][put|get][i16|i32], which is probably also less 
> confusing (for consistency, maybe a packf_puti8 should replace packf_putc, 
> but here I'm less certain). It doesn't touch the rest of the library 
> source, so any attempt to compile Allegro with the patch applied will 
> result in deprecated warnings. I'd like to hear some comments before 
> giving the library a complete overhaul for this.
> 

I don't know if this is a good time to rename them. Using "w" and "l"
for 16/32 bit seems to make as much sense to me as using "i" and "m" for
little and big endian.

Could maybe have:

pack_[put|get][be|le][16|32]

pack_iputl(pf, 17);
pack_putle32(pf, 17);
pack_iputi32(pf, 17);

Actually, when looking at the 3 version above, I vote for keeping the
current names :)

-- 
Elias Pschernig





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