Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-2003, 03:21 AM
Eglin
Hill Giant
 
Join Date: Nov 2003
Posts: 168
Default coding standards

I'm just getting to know your codebase, and I find the lack of coding standards to be a bit overwhelming. I guess this is just symptomatic of having a lot of cooks in one kitchen. It feels like the early Java API, where you could clearly tell which routines were written by which authors because the interfaces were so wildly different! hehe... I noticed that at least one major developer is intimately familiar w/ STL (the single biggest source of my rejuvenated love for c++), while others are ingrained in basic c.

Sorry if my post seems inflammatory... At any rate, I thought I'd mention that I found the i/o functions (and the makeanylengthstring) to be dangerous. Instead of c++ style i/o where the object to be output is asked to serialize itself into a stream or the really new style i/o where you use output iterators to walk structures, most i/o uses the va_args stuff that died back with the stdio stuff a decade ago. The problem with the va_args stuff is that it totally disables c's very refined type-checking. As an example of why this could be problematic, consider the following snippet:
Code:
std::string msg = "teststring";
c->Message(0, "test: %s", msg);
This, of course, isn't correct code. However, it is a very easy mistake to make. By bypassing the type-checking of parameter passing, we have also taken away the compiler's ability to warn us of this error. So, by using msg (like we're used to w/ most library i/o routines) instead of msg.c_str(), we've introduced a runtime error that could easily bring down the entire system. Also a very insidious error to track down.

Not really sure what I hoped to accomplish by posting this (maybe just a gotcha! warning). I certainly don't mean to talk trash about your codebase (or I wouldn
Reply With Quote
  #2  
Old 11-12-2003, 03:44 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

No, I think its great to share things like this..

The code started from a much earlier project, and there were no well defined coding standards in the beginning.. (Most of the coders havent been pro. coders)

What I've found useful for projects is a coding guru that does code reviews and helps the project adhere to well defined standards. People fix what they can here and there.

Any tips, tricks or suggestions are greatly appreciated.

And I know what you mean about Java.. I work in the java code world, and its amazing how many hands I have to slap for people bringing over bad coding practices from C++ into Java.. Ones that really piss me off are these..

for (int x=0;x<array.size();x++)

catch {}

and

people that think vectors should be used anywhere.. In multithreaded apps vectors can be the devil since they're synchronized...
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 01:19 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3