Re: [AD] [BUG] ccolconv.c void * arith.

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


AJ wrote:
Thomas Fjellstrom wrote:

Someone on #allegro was toying with making the MSVC build not dependant on asm and hes hit a road block:

<FrozenSpoon> void *src; src += 4; = error: void * is unknown size :/

all throughout ccolconv.c it does stuff similar to that, arith on a void pointer.

Now GCC will take it (why?) but he says his MSVC will not.


i guess:   msvc is preparing for the day ptrs are 64bit.

I don't think 64-bit pointers have anything to do with it. Normally when you +/- a pointer, it adds/subtracts the number after multiplying it by the size of the type. Since 'void' has no size, it would evaluate to and always be 0. Though the standards have opted to say 'this isn't possible' instead of allowing potential problems (after all, you wouldn't expect ptr += 10; to do nothing), GCC treats a void pointer as a char pointer.

I don't know if -Wpointer-arith would be wise.. wouldn't that disable any math on any pointer type? It sounds like it would, anyway.




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