I am upgrading a large, outdated MFC code base that contains a true mixture of string types:
- Cstring
- std :: string
- stand :: wstring
- char *
- wchar_t *
- _bstr_t
I would like to standardize one type of string inside and convert to other types only when it is absolutely necessary for a third-party API (i.e., COM or MFC functions). The issue that we are discussing with colleagues; What type of string should we standardize?
I would prefer one of the standard C ++ strings: std :: string or std :: wstring. I personally tend to std :: string, because we donβt need wide characters - this is an internal code base without a client-oriented user interface (i.e. multi-language support is not required). The "Plain" strings allow us to use simple, unvarnished string literals ("Hello world" versus L "Hello world" or _T ("Hello world")).
Is there an official position for the developer community? When you come across several types of strings, what is usually used as the standard "internal" storage format?
source
share