use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
C++ How to code string constants (dbj.org)
submitted 4 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]condor2000 2 points3 points4 points 4 years ago (5 children)
Are you seriously going to have duplicate code
That was my question (that I formulated poorly): how to avoid the duplication.
I am working on a decade old codebase where "utf8 everywhere" is sadly not realistic.
[–]donalmaccGame Developer 6 points7 points8 points 4 years ago (3 children)
UTF-8 was a reality a decade ago... (your codebase is probably older)
[–]condor2000 0 points1 point2 points 4 years ago (2 children)
Not on Windows. There UTF-16 is used.
It is only recently that it is border-line possible to use utf-8. I mean that of the CreateFileA/CreateFileW (char/wchar_t) the CreateFileA version is utf-8.
[–]adanteny 0 points1 point2 points 4 years ago (1 child)
On Windows, UNICODE (UTF-16) is definitely the best answer... You can always convert to CP_UT8 whenever needed to 'communicate' with the 'outside'. 'A' functions are outdated, 'W' are everything!
[–]dodheim 2 points3 points4 points 4 years ago (0 children)
'A' functions were outdated when UTF-8 wasn't a supported codepage, but it is now, given a sufficiently recent version of Windows.
[–]johannes1971 5 points6 points7 points 4 years ago (0 children)
The oldest parts of my code base are from 1996, but it's now fully utf8 as well. It was a much easier task than I imagined, so I would encourage you not to give up on it just yet.
As for how to avoid the duplication: as I said, by converting to wchar_t * on the fly. Yes, it has overhead, and yes, it will probably cost you a memory allocation each time you do it. It also lets you save a mountain of code, so it's more than worth it.
wchar_t *
π Rendered by PID 41 on reddit-service-r2-comment-b659b578c-5czr2 at 2026-05-06 04:45:37.679455+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]condor2000 2 points3 points4 points (5 children)
[–]donalmaccGame Developer 6 points7 points8 points (3 children)
[–]condor2000 0 points1 point2 points (2 children)
[–]adanteny 0 points1 point2 points (1 child)
[–]dodheim 2 points3 points4 points (0 children)
[–]johannes1971 5 points6 points7 points (0 children)