Skip to main content
GameDev.net gamedev.net
🔒 Locked

stl for C ?

Started by Tylon Feb 1, 2005 at 3:24 AM 15 replies 20.1k views
Original Post
Tylon
Tylon
Is there a C equivalent of the STL for C++? I know there wont be an exact equivalent, coz the STL is part of the C++ standard, but is there a stable, accepted library that the community mostly uses? The features I am interested are things like array lists, linked lists, hash tables etc. Thanks!
sakky
sakky
Did you just ask if C supported C++ classes?
Take back the internet with the most awsome browser around, FireFox
ToohrVyk
ToohrVyk
sakky: classes don't have anything to do with libraries. Most languages do have libraries that do not use classes in the C++ sense (and, for instance, O'Caml has a standard library that is approximately as powerful as the STL, but uses no classes in it).

Tylon: while I do not doubt the existence of such libraries, they will certainly be awkward to use because of frequent type casting (as C is lacking universal polymorphism). I do not know of any, personnally. At the risk of sounding a C++ zealot, may I inquire why you must use C only (and not C++) ?
Melekor
Melekor
Did you know GLIB has a function called g_blow_chunks()? True Story.
Instruo
Instruo
Quote:

At the risk of sounding a C++ zealot...


what's wrong with being a C++ zealot? OOP, once understood, makes life so clean and simple ;)
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
Telastyn
Telastyn
Quote:
Original post by Instruo
Quote:

At the risk of sounding a C++ zealot...


what's wrong with being a C++ zealot? OOP, once understood, makes life so clean and simple ;)


"once understood" being the key words of course. In the mean time, you get to try and avoid undefined behavior, design pitfalls, and the ever-common vague technical reference.

Not to say that C doesn't have it's own minefields, but C++/OOP isn't the panacea most make it out to be.
Instruo
Instruo
maybe you just don't understand it very well :D
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
ToohrVyk
ToohrVyk
Quote:
what's wrong with being a C++ zealot? OOP, once understood, makes life so clean and simple ;)


C++ is a language, OOP is a programming paradigm. C++ happens to natively implement a (limited) version of OOP, but this is the only relationship between the two. OOP does not require fancy "class" keywords in the language to be used, it only requires the existence of a linking step (and I'm not even sure THAT is required). You can do OOP with any language, including C, so it's not legitimate to use OOP as a justification for using C++
LessBread
LessBread
Here's a previous post about "templates" in old-school C. I dropped some code that implements a template styled vector data structure at the bottom.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Zahlman
Zahlman
Quote:
Original post by Instruo
Quote:

At the risk of sounding a C++ zealot...


what's wrong with being a C++ zealot? OOP, once understood, makes life so clean and simple ;)


At the risk of sounding like a Java (or Smalltalk, or any of a gazillion other languages for that matter) zealot: How is that an argument for C++? [smile]
Instruo
Instruo
I actually prefer C#, personally, I was just joking around. I do think that OOP is generally the better way to go, and I think that C is somewhat outdated and is just making things harder than they need to be for... what? Some principle or something that I don't see, I suppose. (And don't tell me 'performance', because most applications don't begin to scratch the surface of what modern hardware can do). Anyway, enough of that rant ;)
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
Sagar_Indurkhya
Sagar_Indurkhya
I like using C sometimes because of the power I feel.

You know, like when you are a sniper, and wear all this gear, and just sit and watch all day. Than you come home, and battle with samuarai swords. You can literally feel the torque of the handle as you swing it. You can count the cycles like you can your heartbeat.
dongre.avinash
dongre.avinash
Here is the one I have started, Yet to finish , but you can take a look .
http://code.google.com/p/cstl/
Evil Steve
Evil Steve
Really? You bumped a 6 year old thread for that?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.