What's C's biggest mistake?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Jan 1 12:59:56 PST 2010


bearophile wrote:
> Walter Bright:
>> 3. The glaring fact that std::vector<char> and std::string are
>> different suggests something is still wrong.
> 
> In an array/vector you want O(1) access time to all items (ignoring
> RAM-cache access/transfer delays), while in a string with
> variable-width Unicode encoding that can be hard to do. So they look
> like two different data structures.

The real reason is different (multibyte support in std::string is at 
best nonexistent). std::vector was defined by Stepanov alone. But by the 
time std::string was standardized, many factions of the committee had a 
feature on their list. std::string is the result of that patchwork.

Andrei



More information about the Digitalmars-d mailing list