[Scummvm-devel] Namespaces

Max Horn max at quendi.de
Thu Oct 2 10:20:05 CEST 2003

Hi folks,

I was thinking about making more use of namespaces in ScummVM. In 
particular, I'd like to propose that each engine module (scumm, simon, 
sky, sword2, queen) shall put (most of) its classes etc. into a unique 
namespace (Scumm, Simon, Sky, Sword2, Queen).

Right now, we use the old "prefix" approach to avoid name clashes. For 
example, in scumm/ we have class Sound, and the others have SimonSound, 
SkySound, BaseSound. Using namespaces for this IMHO is simply much more 
elegant. Also, if we strictly adhere to using a unique namespace for 
each project, we avoid any name clashes (and the problems caused by 
this, esp. if they are 'silent') right from the start.

The current "ScummVM" namespace (used by some stuff in common) then 
would be renamed ot something like "Common" to avoid mixing it up with 
the "Scumm" namespace.

I really see no negative point about this, only positive. I am willing 
to do most of the needed work, which essentially amount to adding some 
"namespace FOO { }" and "using namespace FOO" in our header&source 

Still, wanted to ask what people think about it before I touch most of 
our files :-)



More information about the Scummvm-devel mailing list