1

This is a followup to this question

AnsiString is a class, too? And string? It is a class? And a char[]?

Can we say a WideString is a wrapper over double-byte characters, AnsiString is a wrapper over single-byte characters, and char[] is an array of single-byte characters? string not so sure what it is...

Not sure about the diferent kind of string types I have in Code Builder C++ 2007 available and its portability.

Community
  • 1
  • 1
Eduard
  • 664
  • 2
  • 14
  • 26

1 Answers1

3
  • AnsiString is a class provided C++ Builder,
  • std::string is class provided by the C++ standard library,
  • char [] creates an array of the type of character,
  • char * creates a pointer to the type character,
  • BSTR is a Windows COM specific string class.

AnsiString and BSTR are non portable, while std::string, char [] and char* are completely portable.

bluish
  • 26,356
  • 27
  • 122
  • 180
Alok Save
  • 202,538
  • 53
  • 430
  • 533
  • Also worth noting that System::String is an alias for AnsiString in 2007 and earlier, but UnicodeString in 2009 and later. – David Dean Feb 27 '12 at 16:12
  • 2
    `WideString`, `UnicodeString`, and `std::wstring` are also classes available in C++Builder. `WideString` (which is a wrapper for `BSTR`) and `UnicodeString` are encoded as UTF-16, but the encoding of `std::wstring` is platform-dependant as `wchar_t` is 16-bit on some platforms and 32-bit on others. – Remy Lebeau Feb 29 '12 at 09:33