Lessons learned from string-fix and consequences on StringNg design

From: Kinkie <gkinkie_at_gmail.com>
Date: Thu, 12 Feb 2009 17:19:28 +0100

Hi all,
   the work on string-fix is nearing completion, and it yielded some
interesting insight on an issue also affecting the StringNg design,
I'd like to have some input on: storage size and API

StringNg uses currently size_t as its storage size, which is probably
a bit impractical. A on 64bit platforms, 2^64 bytes-long single-chunk
string doesn't really make sense. However, it is necessary for one
specific bit of API, which is the useage of std::string::npos as a
return value for "not found" in the various find() functions.

It would IMHO make sense to:
1. introduce StringNg::size_type, which should be a _signed_ 32-bit integer
2. introduce a static const StringNg::npos = -1 to be used in place of
std::string::npos

2Gb-long Strings should suffice for a while, and the String design is
probably not very sane for Strings whose max is not known in advance
and are bigger than a few Mb anyways.

What do you guys think?

-- 
    /kinkie
Received on Thu Feb 12 2009 - 16:19:39 MST

This archive was generated by hypermail 2.2.0 : Fri Feb 13 2009 - 12:00:03 MST