axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kenneth Chiu <ch...@cs.indiana.edu>
Subject Re: STL elimination - Suggestions
Date Thu, 06 May 2004 04:11:17 GMT


On Thu, 6 May 2004, Susantha Kumara wrote:

> Hi all,
>
> I would suggest following order and steps to gradually eliminate STL in
> Axis C++ codebase.
>
> std::string
> 1.	Use "char*" instead of "string" wherever possible - need to take
> care of the memory allocation and deallocation
> 2.	Write our own String class to replace the strings left after
> step 1.

I would suggest reversing the priority of 1 and 2.

    1.  Use std::string wherever possible.
    2.  Otherwise, use your own string class.
    3.  Otherwise, use "char *".

The times when you really need number 3 should be very few.

> std::map
> 1.	Review the code base and minimize the use of std::map's
> functions. Replace std::map with arrays or lists where possible
> 2.	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
> a.	void* for key
> b.	void* for value
> c.	allocator/deallocator provided externally
> d.	key comparison function provided externally
>
> std::queue
> std::list
> std::stack
> 1.	Probably we can use linked lists to replace these.

I personally believe you will be better off in the long run
if you fix the STL problems by changing the way you use it,
rather than trying to replace it everywhere.

The STL gets a lot of testing.

Mime
View raw message