axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lilantha Darshana <>
Subject RE: STL elimination - Suggestions
Date Thu, 06 May 2004 22:10:50 GMT
I would suggestion at this point going for w_char * for strings handling to
Unicode char-sets.

Think twice when you replace std::string with your impl. of a String class.
Do a performance 
comparison and usability study. Your class should out perform std::string in
the context 
you use. o/w stick with std::string.

Writing your own Map class is also the same -- std::map impl. uses best
algorithms available
today. hence, If you go for your impl. you should think twice. -- if it
possible to replace 
key/value lookup with index/value lookup then just go for using an array.
o/w its an overkill. 
and harder to use. void pointer casting require some more instruction in
it's machine code. 
But compile time binding does not involve any additional instruction in its
object code. 

But if you could make your code simple and avoid using std::maps, that's
really improves the 
performance. Iff simple C code/algo can do the same task.

But f we can avoid using following in most of the cases if you know the size
of the collection 
before hand. by using a simple array.



-----Original Message-----
From: Susantha Kumara []
Sent: Wednesday, May 05, 2004 11:30 PM
To: axis-c-dev
Subject: STL elimination - Suggestions

Hi all,
I would suggest following order and steps to gradually eliminate STL in Axis
C++ codebase.
Use "char*" instead of "string" wherever possible - need to take care of the
memory allocation and deallocation 
Write our own String class to replace the strings left after step 1. 
Review the code base and minimize the use of std::map's functions. Replace
std::map with arrays or lists where possible 
Write our own Map class with minimum functionality and use it in yet
existing places after step 1. Even if we don't use templates to write this
map class we can make this almost generic if we use a class which has 
void* for key 
void* for value 
allocator/deallocator provided externally 
key comparison function provided externally 
Probably we can use linked lists to replace these. 

View raw message