Talk:String Byte Length: Difference between revisions

The C++ example was right
(also deleted the erroneous c++ wchar string length example)
(The C++ example was right)
Line 1:
The C and C++ examples of finding the length of a string of wide characters (wchar_t) were just plain wrong, so I deleted them. Regardless of string length, the examples would always show 16 because it was computing against the length of a ''pointer'' to a wchar_t, rather than the length of the string. —[[User:139.85.252.186|139.85.252.186]] 17:00, 23 April 2007 (EDT)
: I've undone the delete of the C++ example. While you were right about the C example (except it will show the product of a pointer size and a wchar_t size, which is not necessarily 16, but depends on the CPU and OS), the C++ example does not even contain a pointer (except hidden somewhere in the internals of C++), and std::wstring::length() returns the number of characters, not the size of a pointer (which would be quite pointless anyway). --[[User:Ce|Ce]] 17:40, 23 April 2007 (EDT)
973

edits