Talk:C Programming/String manipulation

Is there some reason why the function names on this page are enclosed in parenthesis? While it does clarify the return type, I think it's technically an unnecessary construct. --Sigma 7 (talk) 01:29, 20 March 2009 (UTC)


 * I suspect it's to avoid possible clashes with macros with the same names as the functions. -- James Dennett (talk) 04:31, 20 March 2009 (UTC)

plain talk
I renamed the variables in "ststr" as recommended at CommunityWiki: PlainTalk. This is a functionally-identical refactoring. Since compilers will produce identical code no matter what you name the variables, we might as well use human-understandable variable names like "haystack", "needle", "source", "dest" rather than "s1" or "s2". --DavidCary (talk) 02:54, 9 September 2009 (UTC)

wchar_t
Is not "16 bit (at least)", wchar_t should be able to handle at least char values. But wchar_t often wider, than just char, and has 16/32 bit width.

And about encodings: it's necessary to say that wchar_t is only INTERNAL representation for wide strings and has no deal with external encoding in system. How to get wchar_t from outer world and how to print wide characters depends on selected locale and conversion between internal representation and external encoding done automatically by wide character I/O functions such as wprintf, wscanf etc. The only conditions is that external locale should be loaded properly by setlocale (LC_ALL, ""); and, of course, input should be in that locale.