Re: [AD] PATCH: updated mprotect patch for allegro-4.2.1 which also work on Linux

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



Evert Glebbeek wrote:
Normal conventions say that sizeof(long) is the largest integer an arch
can represent unless sizeof(int) is larger then that in which case
sizeof(long) == sizeof(int)

It is my understanding that int is (was?) the machine's native integer size, ie, 16 bit on 16 bit machines, 32 bit on 32 bit machines and 64 bit on 64 bit machines. 64 bit PC's already differ from this by having int as a 32 bit type.

Nope, AFAIK int is the optimal iow best speed/size tradeof integer size (which the machine preferably can represent nativly, exception to this are microcontrollers which are typically 8 bit, yet have 16 bits ints, because 8 bit is deemed to small).

I think this is also part of the reason for Microsoft sticking with 32 bit long: there's a lot of Windows-specific code floating around that thinks a long is 32 bit for historical reasons. On the other hand, I think MS also used typedefs such as BYTE, WORD, DWORD (and QWORD?), so I don't really see why they cannot just update their typedefs...


I think so too, but there is also lots of newer code which asumes sizeof long == sizeof(void *) so they are not helping themselves I believe.

long long is not a C basis type.

It is in C99.


Ok, I'm more of an ANSI (C89) person.

Regards,

Hans




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