• Advertisement
Sign in to follow this  

Unity stl for C ?

This topic is 2473 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Glib (http://www.gtk.org) has all of that, and more. It's still tedious to use, mainly because you'll have to do a lot of (unsafe) casting. It's probably better than rolling your own though (more generic). Its a LGPL library.

Hope this helps.

Share this post


Link to post
Share on other sites
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++) ?

Share this post


Link to post
Share on other sites
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 ;)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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++

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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 ;)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by 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 ;)


C is still the most portable and interoperable language. Nearly every language has C bindings; rarely do you find bindings to other languages. C has sweet simplicity on its side for those who prefer the OOP of CLOS or Smalltalk (dare I even venture to realms outside OOP? Functional programming? Haskell? Scheme? OCaml!?! Heresy!) but have some need to drop to a lower level (speed, foreign libraries, etc.).

Note I'm saying C is better than anything else, just that it has its place. It's quick and dirty for when you need to deal with the nitty gritty under higher level languages.

As for the original question, there aren't many libraries of that sort for C. As mentioned, glib is a good place to look. But why wouldn't C programmers have such a library? Two reasons:

1) They do, it's just a home brew. Back in the day, there was less focus on libraries and so people had to cook up their own. These are perfectly suited to the needs they had, so why would they use some third party library? (If it ain't broke...)

2) As I said, C is an "under the hood" sort of language. (C++ is more like a car without a hood! [lol] Ha! haha... you know I'm funny! err... now you know why I'm anonymous [cool]) General purpose libraries aren't fine tuned for specific purposes. But if you're using C, it's usually because you need something fine tuned for specific purposes.

Share this post


Link to post
Share on other sites
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.
</end wierd metaphor>

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Now

  • Advertisement
  • Similar Content

    • By RoKabium Games
      Another one of our new UI for #screenshotsaturday. This is the inventory screen for showing what animal fossils you have collected so far. #gamedev #indiedev #sama
    • By eldwin11929
      We're looking for programmers for our project.
      Our project is being made in Unity
      Requirements:
      -Skills in Unity
      -C#
      -Javascript
      -Node.js
      We're looking for programmers who can perform a variety of functions on our project.
      Project is a top-down hack-and-slash pvp dungeon-crawler like game. Game is entirely multiplayer based, using randomized dungeons, and a unique combat system with emphasis on gameplay.
      We have a GDD to work off of, and a Lead Programmer you would work under.
      Assignments may include:
      -Creating new scripts of varying degrees specific to the project (mostly server-side, but sometimes client-side)
      -Assembling already created monsters/characters with existing or non-existing code.
      -Creating VFX
      -Assembling already created environment models
      If interested, please contact: eldwin11929@yahoo.com
      This project is unpaid, but with royalties.
       
      ---
      Additional Project Info:
      Summary:
      Bassetune Reapers is a Player-verus-Player, competitive dungeon crawler. This basically takes on aspects of dungeon crawling, but with a more aggressive setting. Players will have the option to play as the "dungeon-crawlers" (called the 'Knights', or "Knight Class", in-game) or as the "dungeon" itself (literally called the 'Bosses', or "Boss Class", in-game). What this means is that players can choose to play as the people invading the dungeon, or as the dungeon-holders themselves.
      Key Features:
      -Intense, fast-paced combat
      -Multiple skills, weapons, and ways to play the game
      -Tons of different Bosses, Minibosses, creatures and traps to utilize throughout the dungeon
      -Multiple unique environments
      -Interesting, detailed lore behind both the game and world
      -Intricate RPG system
      -Ladder and ranking system
      -Lots of customization for both classes s of customization for both classes
    • By RoKabium Games
      Custom coffee mugs have arrived... More caffeine!
      Have a great weekend everyone! 
      #gamedev #indiedev #sama #caffeine
    • By Atwo Studios
       
      Hey guys,

      Anthony here from Atwo Studios bringing you some new updates for the new year!
      In this video I go over our game ROY, the new games and some general updates to the company!

      If you have not checked out ROY feel free to give it a try! Many people have said they enjoyed the game thus far!
      ROY: https://goo.gl/o6JJ5P
       
    • By Affgoo
      https://play.google.com/store/apps/details?id=com.NE.Alien
      still a lot of work to do, but its pretty stable  please let me know what you think <3
      Atlas Sentry is a game of destroy everything. Using your turret, simply swivel and shoot your way to victory, upgrading your weapons to unleash destruction on the variety of spaceships. The bigger your combo’s the more score you get! Earn silver as you play and then purchase new weapons and abilities to better deal with your enemy. Different enemies use different tactics and weapons, work out your own priorities in their destruction order. 

      Features: 
      **2 different game modes 
      **A level select mode with 20 difficult levels including a final boss, can you defeat it? **Arcade mode of endless destruction, how long will you last? 
      **High scores to compete against others, see who can take the top spot. 
       
  • Advertisement