Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-08-02 06:58:39


At 04:37 AM 7/7/2003, Russell Hind wrote:

>I'm not saying replace all the XXXX_string methods with a str() but
>jshould we have
>
>str()
>native_file_str()
>to_simple_str()
>
>or
>
>string()
>native_file_string()
>to_simple_string()
>
>just to commonise things.
>
>Filesystem has a string() method. stringstreams use str(). I also
>agree that boost libraries don't need a c_str() method since this can
>come from the string() (or str()) method.

There are obvious advantages to common naming conventions.

But "str" vs "string" isn't as clear-cut as it would be if we were starting
with an empty page.

"string" is better because it is more explicit and less prone to
misunderstanding. But many existing libraries (boost and non-boost) use
"str". Actually, that's one of the problems with "str". It is not uncommon
to see it used for functions which return char*'s, std::strings, or
homebrewed types, and that's confusing. That was part of my rationale for
chosing "string" as the name in the filesystem library.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk