Why does scummvm not use stl?

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

Post Reply
rsn
Posts: 2
Joined: Mon Dec 29, 2008 5:59 am

Why does scummvm not use stl?

Post by rsn »

While taking a look at the source I noticed that rather than just using the STL scummvm developers have gone on reinventing the wheel. What's the reason behind this?
User avatar
sev
ScummVM Lead
Posts: 2316
Joined: Wed Sep 21, 2005 1:06 pm
Contact:

Post by sev »

There are several reasons for that.

First, STL is not that portable and does not exist on all ports we support. Then, even when it is ported on a platform, it is a monster code-wise, take some of the smaller device ports into account. And that's why instead of reinventing the wheel our implementations are quite lightweight.


Eugene

PS. In fact, this question better fits scummvm-devel.
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

When I was a young boy new to ScummVM, I tried to convince people to use STL (or even the full standard C++ lib, too). But as Sev pointed out, it has some severe drawbacks: It has a lot of overhead in terms of binary size (which is very important on e.g. Nintendo DS, were we are happy for every KB we can save); in terms of memory usage; (our String class has less features than std::string, but it also takes far less memory on the heap); and our code works on all of the dozens of platforms and compilers ScummVM runs on, while the STL is not available everywhere, and sometimes only varying subsets are available.

Therefore, we chose to "reinvent the wheel", if that's what you want to call it (though String classes, simple linked lists etc. are such simple and fundamental data structures taught in every "Programming 101" class, that I would rather call it a "simple exercise" ;-). Although the performance / memory tuning isn't always... :)
rsn
Posts: 2
Joined: Mon Dec 29, 2008 5:59 am

Post by rsn »

Thanks for the replies 8)
Post Reply