mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-05 00:36:57 +00:00
fixed the non-POD warning for real this time
svn-id: r4999
This commit is contained in:
parent
8390b0cc53
commit
5d72701c06
@ -22,8 +22,16 @@
|
||||
#ifndef SAVELOAD_H
|
||||
#define SAVELOAD_H
|
||||
|
||||
#define OFFS(type,item) ((int)(&((type*)0)->type::item))
|
||||
#define SIZE(type,item) sizeof(((type*)0)->type::item)
|
||||
// To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
|
||||
// we use a small trick: instead of 0 we use 42. Why? Well, it seems newer GCC
|
||||
// versions hae a heuristic built in to detect "offset-of" patterns - which is exactly
|
||||
// what our OFFS macro does. Now, for non-POD types this is not really legal, because
|
||||
// member need not be at a fixed offset relative to the variable, even if they are in
|
||||
// current reality (many of our complex structs are non-POD; for an explanation of
|
||||
// what POD means refer to http://www-cpd.fnal.gov/personal/wb/boost/ISOcxx/doc/POD.html)
|
||||
|
||||
#define OFFS(type,item) (((int)(&((type*)42)->type::item))-42)
|
||||
#define SIZE(type,item) sizeof(((type*)42)->type::item)
|
||||
#define MKLINE(type,item,saveas) {OFFS(type,item),saveas,SIZE(type,item)}
|
||||
#define MKARRAY(type,item,saveas,num) {OFFS(type,item),128|saveas,SIZE(type,item)}, {num,0,0}
|
||||
#define MKEND() {0xFFFF,0xFF,0xFF}
|
||||
|
Loading…
Reference in New Issue
Block a user