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 ]



Στέφανος Αποστολόπουλος wrote:
On Sun, 12 Mar 2006 11:25:49 +0200, Hans de Goede <j.w.r.degoede@xxxxxxxxxx> wrote:



Chris wrote:
On Sunday 12 March 2006 01:08, Hans de Goede wrote:
+ char *p = (char *)((unsigned long)_scratch_mem & ~(PAGE_SIZE-1ul));
C99 and Allegro define uintptr_t for casting pointers to int types. Would probably be better if you used that instead.


Makes no difference this always hold: sizeof(long) == sizeof(void *)

Regards,

Hans


No, this does not hold for 64 bit windows, where sizeof(void *) = 8 and sizeof(long) = 4 (the 64 bit datatype is long long, and not long as in 64 bit linux). The portable way would be using uintptr_t as suggested.


What the !@#$% MS idiots what were they thinking everyone uses long == 64 bits on 64 bit archs, so hey lets be microsoft lets do it different.

I CANNOT believe this thats absurd, I've been writing 64 bit patches for tons of software and I (and many others) have always used long. Also isn't this more compiler specific then platform, iow VisualC gets it wrong but gcc for windows does it right?

Anyways back on topic I normally don't use uintptr_t because it isn't available everywhere and long is, but since allegro defines it its safe for allegro use, so I'll ammend the patch.

Regards,

Hans




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