STL

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

STL

Post by frank »

Does anyone know of a good easy to port to kernel space STL. I have come across quite a few and they all rely heavily on exceptions and lots of headers I don't have and don't wish to create. I would like to be able to use vectors, lists, dequeues, and at least some of the associative containers. I thought I would ask before I try my hand at ripping the exceptions out and trying to make up the rest of the headers.

Thanks,
Frank
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

You could write your own. It's shouldn't be too hard. (That is, if you just write a small subset of it.)
C8H10N4O2 | #446691 | Trust the nodes.
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

Well does anyone have a good reference on the internals of the STL? There are plenty of good references on the interface but few on the internals.
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Post by Kevin McGuire »

Candy should know. He does a lot of reading about these types of things. He had ought to find this message is no one else replies with any good information about that sort of stuff.
User avatar
bluecode
Member
Member
Posts: 202
Joined: Wed Nov 17, 2004 12:00 am
Location: Germany
Contact:

Post by bluecode »

I bought "The C++ Standard - Incorporating Technical Corrigendum 1" (published by Wiley), but there is also the final Draft of the C++ Standard (also including technical corrigendum 1. Just for the record: imho in some STLs you can disable exceptions with a define or something similar.
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

SGI used to have good docs on the interfaces, and insight into the "under-workings" of the library; I used to use those sites whenever developing on top of STL, at least. I assume they would be of some use if implementing your own STL, as well (but they are mostly geared towards development on top of STL).

A searched google, and found this -- looks like the same site I remember:
http://www.sgi.com/tech/stl/

--Jeff
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: STL

Post by Candy »

frank wrote:Does anyone know of a good easy to port to kernel space STL. I have come across quite a few and they all rely heavily on exceptions and lots of headers I don't have and don't wish to create. I would like to be able to use vectors, lists, dequeues, and at least some of the associative containers. I thought I would ask before I try my hand at ripping the exceptions out and trying to make up the rest of the headers.
You can disable exceptions fairly easily (IIRC it's a define indeed), replacing allocation & such by your own should be trivial. Do notice what functions return when they fail without exception, because you should (must) handle those cases.
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

Ok now then does anyone know of a good STL implementation that I can try to port? I have downloaded a couple and most of them just fail with 100s of compiler warnings. I could try to fix them but I am developing an OS not a STL.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

Have you tried uSTL?
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

or STLPort ?
nick8325
Member
Member
Posts: 200
Joined: Wed Oct 18, 2006 5:49 am

Post by nick8325 »

I ported SGI STL to my kernel before. It wasn't too hard. You can disable exceptions by editing stl_config.h; apart from that, the only problem I found was that it calls fprintf(stderr, ...) in a few places.

EDIT: I just noticed that it needs new.h. That means you have to define operator new, but the wiki explains that (under "new and delete").
hendric
Member
Member
Posts: 38
Joined: Sat Oct 21, 2006 10:56 am
Location: China

Post by hendric »

Well , I know there's a Chinese provide a simple STL (Both With C , which amazing me a lot , and C ++ ) porting to x86ã€
Just Lazy Writing Anything...
Post Reply