[Scummvm-devel] START_PACK_STRUCTS default changed -- port breakage
Torbjörn Andersson
eriktorbjorn at telia.com
Sat Jul 22 19:50:04 CEST 2006
Max Horn wrote:
> Nope, that wasn't the cause. The problem was caused by the fact that
> GCC (apparently unlike Visual C++ / Metrowerks ?!?) does not
> interpret macros inside #pragma argument. I.e. this works:
>
> #pragma pack(1)
>
> but this doesn't:
>
> #define FOO pack(1)
> #pragma FOO
See? See?! I really am unqualified! ;-)
> That would be quite a big task, and would decrease code readability
> (IMHO)... Normally I'd say: We could undertake it, but I see nothing
> to be gained by it at this time.
Tell me about it. I did it in Broken Sword 2 because I got reports about
alignment problems. That may have been because that engine used to point
to arbitrary addresses and say "the packed struct starts here". (For
instance, by pushing a pointer to a script's local variable, which could
be anywhere inside an allocated block of memory.)
I don't know if the other engines do things like that, or if they simply
declare a packed struct and read data into it, which is probably a much
safer operation. If things work again, without the GCC extension, maybe
it's not a problem after all.
Torbjörn
More information about the Scummvm-devel
mailing list