more robust C++ implementation code

Description

Try to use some more advanced C++ techniques to make our code more concise, more robust, and easier to maintain.

  • some form of auto_ptr, scoped_ptr or similar

  • for vanilla C++ new/delete and new[]/delete[]

  • for uprv_malloc()/uprv_free()

  • for ICU C service objects with uxyz_close()
    (this version should be public API to make life easier for our users)

  • see also Taligent's Safe Pointers

  • C++ class for stack array objects with fixed size that's not necessarily known at compile time

  • real char* string class rather than uprv_strcpy(), udata.c's TinyString, etc.

  • cannot just use STL string because we need to route memory allocation
    through ICU's functions

Activity

Show:
TracBot
June 30, 2018, 11:35 PM
Trac Comment 1 by —2009-11-14T19:33:18.000Z

LocalPointer & LocalArray & LocalUConverterPointer etc. implemented with ticket #7245, to be tested and used better with ticket #7247 (which will also add an internal version for uprv_malloc()/uprv_free()).

That leaves the stack array class (combine with the LocalMemory/uprv_malloc() class??) and the char* string class.

TracBot
June 30, 2018, 11:35 PM
Trac Comment 2 by —2009-11-20T23:39:39.000Z

Stack array class also done with ticket #7247.

TracBot
June 30, 2018, 11:35 PM
Trac Comment 4 by —2010-03-03T21:34:40.000Z

Commits here were only for temporary test code to see if all relevant compilers support templates. That test code was removed while I worked on real LocalPointer, MaybeStackArray etc. with other tickets. I just submitted ticket #7496 (add internal char * string class for C++ implementation code) for the remaining piece of work so that this ticket can be reviewed for ICU 4.4.

Fixed

Assignee

Markus Scherer

Reporter

Markus Scherer

Components

Labels

None

Reviewer

None

Priority

medium

Time Needed

Hours

Fix versions