[Scummvm-devel] Header files.

Marcus Comstedt marcus at mc.pp.se
Sun Dec 21 08:51:00 CET 2003


Hi all.

I've become increasinly annoyed with the current situation concerning
header files in ScummVM.  Right now, <scummsys.h> always gets included
one way or another.  However, because of the the trickery involved
with free_check, the system headers defining the prototype for the
real free() must be included _first_.  This is handled by <stdafx.h>,
which is included directly by the individual C++ files.  Both
<scummsys.h> and <stdafx.h> contain a lot of #ifdefs on the OS, and
<stdafx.h> additionally includes <portdefs.h>, iff NONSTANDARD_PORT is
defined.

Isn't this a bit messy and over-complicated?  Can't we do this
instead:

* <scummsys.h> always includes <portdefs.h> (after config.h, probably)

* The backends which don't have a portdefs.h get one (initially empty)

* Everything from <stdafx.h> goes into the respective <portdefs.h>.
  Nothing includes <stdafx.h> anymore.

* <stdafx.h> goes away.  => NONSTANDARD_PORT goes away.

* OS-dependent #ifdefs from <scummsys.h> also goes into <portdefs.h>.
  Stuff that are not tied to a particular port, such as big/little
  endian and alignment/nonalignment #ifdefs, stay.

* Should common elements be found in multiple <portdefs.h> files, they
  can be considered for moving into <scummsys.h>.

?  The x11, sdl and null backends should probably share <portdefs.h>,
but that seems simple enought to fix.


  // Marcus






More information about the Scummvm-devel mailing list