[Scummvm-devel] Replacing Common::Map by std::map

Marcus Comstedt marcus at mc.pp.se
Sun Jan 16 04:40:26 CET 2005


Max Horn <max at quendi.de> writes:

> It's not so much about the time "we" (that is: I, as I am the only one working on these things, it seems) spend on maintaining Common::Map -- 
> it's only a small part of the whole common/ rat nest.

What is it about then?  If there is no time spent maintaining
Common::Map, then there is nothing to be gained by not spending any
time maintaining something else instead.


> I spent a lot of time writing that code, which I could have spent on
> more important things if we didn't use to have that silly policy of
> not using the standard C++ lib.

Of course.  But you will not get that time back by not using
Common::Map anymore, so whether those important things will be written
or not is not dependant on whether we toss Common::Map now or not.


> While that time is already lost now, I
> refuse to waste any more of my time reimplementing things which are
> available in every C++ system for free.

Common::Map is already implemented though, so there is no need to
waste any time, is there?


> Furthermore, every capable C++ programmer should know the STL /
> Standard C++ lib. It's part of the language. And so they all should be
> able to understand code using std::map, std::string, etc.. Compared to
> that, our Map/String/etc. classes are custom; coders have to learn
> about them first. That makes it harder to maintain our code, and makes
> it harder for newbies to participate in our project.

This is true to some extent (I don't know the STL lib by hart, but
presumably I'm not a "capable C++ programmer".  I prefer C anyway),
but I expect that the rather straightforward Map class will be a
rather minor hurdle compared to the rest of the code for a newbie to
get a grip of the ScummVM code bulk.


> All in all, I see lots of real & theoretical advantages speaking for
> using std::map & std::set, and only one drawback: a 0.25% increase in
> the size of my binary. Hm.

Yes, the drawback is very small.  But so are the advantages, IMO.
If we could go back in time in a Chron'O'John and have you not write
the Common::Map class in the first place the advantages would have
been greater, but we can't.


> Anyway, this discussion seems quite silly to me. I mean, we are
> talking a 10 KB increase in an unoptimized build, even less in a
> release build (7 KB over here). I just checked in another code change
> (make use of the new class Common::Mutex) which reduced the code size
> by 5 KB. We have code fluctuations of that size all the time. ScummVM
> grows every day because e.g. the saga code gets developed further.

Grows in incomplete engines is of course expected, and does not affect
any other games if you're using the plugin system, so no problem
there.  And kudos to you for the 5KB shrink!  All efforts to reduce
the size are appreciated, even if they are small.  Many small things
add up to something big.


> Do I have to do byte bookkeeping on every checkin I make now? And
> would have anybody noticed/bothered if I hadn't been stupid enough to
> mention the 10 kb increase? <sigh>

No, but you did, and brought it up for discussion, so why not have
some?  If you did not want discussion, why did you mention it at all?
As the project head honcho you are free to do as you like anyway.


  // Marcus






More information about the Scummvm-devel mailing list