I'm updating some 1990's-era C code and converting it to C++. The original code relies heavily upon Gnome's gslist
(singly-linked list). I'm finding gslist
very cumbersome to integrate into my object-oriented code, so I'd really like to convert all those lists to C++ standard template library's std::list
or std::forward_list
.
Are there any good reasons (performance, portability, etc.) not to migrate to STL, and instead to stick with Gnome?
I would avoid replacing gslist
with std::list
as that would be changing a singly linked list into a doubly linked list. However, I would imagine that std::forward_list
would perform similarly, but depending on the size of your objects you are storing in the gslist
you might see a slight performance difference as well. This would be because of glib using a slice allocator instead of the standard allocator for std::forward_list
.
If you aren't using C++ already, from a portability perspective, you might not want to go with the C++ solution, as not all platforms have a C++ compiler. However, if you can compile Gnome for a platform, I'd imagine it would ship with a decent C++ compiler as well.
One other thing that I could think of is adding the STL dependency could possibly increase executable size, if you aren't already using the STL. You might also see a slight increase in compile times.
The only true way to know is to do some profiling.