rogerdv at February 22nd, 2005 07:30 — #1
Im making some simple networking tests, and I was thinking about what language to use for a definitive game server. I think C would be more suitable for such task, what do you think?
ed_mack at February 22nd, 2005 10:48 — #2
With C, there are no built in checks to stop bad things happening like array overflows. C++/C# is a better choice
nodlehs at February 22nd, 2005 15:55 — #3
I wouldn't say one is better than the other. If you know what your doing c/c++/c# can all accomplish your goal with ease. The question you want to ask yourself is are you more comfortable with one over the others? if your equally capable in each language, how do you want to design it? If you want to make it more modular, more object based, its easier to do that in c++/c# than c. If your more comfortable in c, you can still make it object based, its just a little more work. Aside from whatever features may be included with a language, as in array bounds checking, you should focus more on making your programs without those mistakes to begin with. Don't rely on the language itself to correct your mistakes. Your a programmer, its your job to make sure you have not hit  in an array defined as int foo, not the languages, relying on the language may make your job a little easier, but it also makes for lazy programming practices(again, if you rely on the language to do the work for you).
ed_mack at February 23rd, 2005 00:50 — #4
I completely think that using a language like C is asking for server vunerabilities, it's just human nature and at least higher langauages try to protect you. It's not about being lazy, it's getting the interesting stuff done.
I think the first item here display's my view well
nodlehs at February 23rd, 2005 13:54 — #5
I don't think you quite got what I was trying to say. No matter what language you are using, if you supply an argument to a function that is out of bounds, whether it be in C, C++, or any other language you have a bug in your code. If you don't keep in mind the size of your data and expect the language to do it all for you, thats lazy. I am sorry, if I have an array of 20, and I try to access or set foo20, that is a bug, I don't care if the language protects me or not from it, its just bad practice.
Back to his question, is C good or should he go with something else? As I said, all can accomplish his task, C++ would be a better choice for modularity, which is a great thing to have in a game server. If its just a quick and dirty test, C might be a better choice, as development would be a tad faster and simpler(assuming he knows both C and C++). But if he ever wanted to use it as a base for a larger project, it would be harder to adapt to his new requirements, and would be harder to maintain.
Any vulnerabilities in a C server are just as possible with C++/C#. Proper diligence in design and testing is more important than what language you choose.
anubis at February 24th, 2005 00:55 — #6
No matter what language you are using, if you supply an argument to a function that is out of bounds, whether it be in C, C++, or any other language you have a bug in your code.
right... but in some languages an excpetion gets thrown and you emdiatly see where it happens and in others your foo might happily write to memory unoticed until somebody exploits it.
Any vulnerabilities in a C server are just as possible with C++/C#
how is that ? if your language effectively protects you against buffer overflows your are protected... if not, your are not...
to make a point : you wrote " If you know what your doing" but it should be "If you know what you're doing". you see... people make mistakes and it's good to protect them from it. what you are saying is like : "we don't need no safety belts or air bags because it's the drivers job to keep the car on the street."
ps : excuse me though for picking that lame typo, i was just trying to make a point
nodlehs at February 24th, 2005 12:22 — #7
I understand why you were being a grammar cop In what I was writing I wasn't trying to say that C++ or other languages don't protect you somewhat. I think its great that they provide that feature, and they make it easier to debug your code. I was just trying to point out that, no matter what language you do choose, a bug is a bug, whether the language provides you with feedback about your error or not. Choosing one language over the other doesn't protect you from bugs. I wanted the original poster to be more aware of the fact that no matter what language he should choose, even if features are in place to help restrict fatal errors, or has features to give you valuable information when a fatal error occurs, that he should not rely on it as always going to protect him. There are more things than buffer overflows that can cause problems (it just happens to be a very common problem). Like you said, seatbelts and airbags are good stuff, but they don't always work, and they don't always keep you alive. Plus, I already suggested that C++ would be a much better choice for a more modular, long term, versatile project. Just trying to give the guy info on his options, and making sure he doesn't begin to blindly trust the language to do his error checking for him, its misleading, and the built in stuff doesn't catch everything.
anubis at February 24th, 2005 13:03 — #8
i agree... to be honest, i haven't really read the OP yesterday. to that i can only say : stick with the language you are most proficent in. any mistakes any language might safe you from can't outweigh true experience