08 May, 2009, JohnnyStarr wrote in the 1st comment:
Votes: 0
It seems that each command or handler function in Diku muds use and traverse linked lists. Unlike Array Lists in higher level languages, its obvious that C offers very little support as far as any built in functionality.

EG

Ruby:

a = new.Array
a.sort
a.find
a.delete

Now, the developers of Ruby built in those functions to the 'Array' class right?
So, of course C dosn't use class objects on its own, but has anyone built in anything in Diku that would be similar? or am i stuck having to handle the list each time from scratch?
08 May, 2009, Zeno wrote in the 2nd comment:
Votes: 0
1) Fix code so it compiles in g++
2) Use C++ classes
3) ???
4) Profit!
09 May, 2009, quixadhal wrote in the 3rd comment:
Votes: 0
A linked list is a standard type of data structure. It's designed to be very fast at insertion, and very fast to access the end elements, at the expense of having to traverse the list to find objects or iterate across them. The fact that C doesn't provide built-in support is a both a blessing and a curse.

If you don't like using linked lists, use a different algorithm. You can implement your own binary search trees (or find library routines), or hash tables, or whatever else floats your boat. The main thing is that in C, you will have to use accessor functions. So, while in ruby you might do a.find("foo"), in C, you'd write a find_in_list(a, "foo") function.

Oh, and while Zeno's suggestion IS valid, you'll find there is a LOT of work in step 3, most of it involving having to rewrite just about everything to be able to use STL containers properly. :)
09 May, 2009, Zeno wrote in the 4th comment:
Votes: 0
If you're interested in a binary search tree, look over my BST snippet for Smaug.
09 May, 2009, David Haley wrote in the 5th comment:
Votes: 0
There's really very little point in using straight C to write a MUD, and not take advantage of what C++ offers you – if anything in the STL, never mind the ability to write your own encapsulated data structures.
09 May, 2009, Stormy wrote in the 6th comment:
Votes: 0
If you do stick w/ C, you can check out the list.c file in the SocketMUD codebase. Extending the functionality beyond what is already there is pretty easy.
09 May, 2009, Sandi wrote in the 7th comment:
Votes: 0
David Haley said:
There's really very little point in using straight C to write a MUD, and not take advantage of what C++ offers you – if anything in the STL, never mind the ability to write your own encapsulated data structures.


Huh and huh?

The biggest advantage to using straight C is not having to learn C++. :wink:
09 May, 2009, JohnnyStarr wrote in the 8th comment:
Votes: 0
Ok, well i dont mind learning C++ at all. I've always wanted to. But i just dont know where to begin when it comes to adding things to my ROM base. I noticed someone made G++ clean version of ROM 2.4 so i figure what i could do is compare the differences in my source files and configure my own code to get it to work.

But when it comes to adding Classes and stuff, does anyone have an idea of where to start? Anyone else doing this? I'm sure i could develop a roadmap, but it seems a bit early to start that.
09 May, 2009, Kline wrote in the 9th comment:
Votes: 0
http://www.cplusplus.com/reference/

I've found that link to be invaluable in my efforts to slowly understand and utilize more C++ features. In reference to STL, check out the sections on both STL algorithms and STL containers.
13 May, 2009, JohnnyStarr wrote in the 10th comment:
Votes: 0
cools!
08 Jun, 2009, Runter wrote in the 11th comment:
Votes: 0
Sandi said:
David Haley said:
There's really very little point in using straight C to write a MUD, and not take advantage of what C++ offers you – if anything in the STL, never mind the ability to write your own encapsulated data structures.


Huh and huh?

The biggest advantage to using straight C is not having to learn C++. :wink:


Considering you can write C code that compiles in C++ the learning curve could be nil while getting access to the STL.

But for the record, I'm more of an advocate of using a higher level language for a mud server for most purposes. :P
My current crush is Ruby.
0.0/11