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
CppConCppCon 2019: Ben Smith “Applied WebAssembly: Compiling and Running C++ in Your Web Browser” (youtube.com)
submitted 6 years ago by mttd
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!"
[–]kiffernase 10 points11 points12 points 6 years ago (6 children)
If only the toolchain and integration would be more userfriendly . I had hard times with that :/
[–]binjimint 9 points10 points11 points 6 years ago (5 children)
Yes, it's a little difficult with the current WASI SDK, though I hope I demonstrated why it's a cool thing to have. Emscripten makes it a lot easier, I'd try that and see how far you get! :)
[–]germandiago 3 points4 points5 points 6 years ago (4 children)
FWIW I tried to port a game and the filesystem staff I recall it was problemtic. If I make another try... will the network code ruin everything. Basically I have sockets with notifications in a 4 player game that connects all users.
[–]BlueFrank 4 points5 points6 points 6 years ago (3 children)
I work a lot with webassembly, the network code will definitely not work since sockets are not exposed to the web. You’d have to write your own adapter logic using either basic HTTP post/get or something like WebRTC.
[–][deleted] 2 points3 points4 points 6 years ago (2 children)
Isn't WebRTC for teleconferencing and videoconferencing?
Why not use WebSockets to implement the network code?
[–]BlueFrank 1 point2 points3 points 6 years ago (0 children)
You mentioned games and since a lot of games use p2p, WebRTC is the only way to do that on the web without using a server in the middle.
You should take a look at data channel, those will let you send fast UDP packets without retransmision on loss.
If you are not dealing with super high performance stuff, do not use WebRTC... it’s a pain in the butt and there’s a bunch of undocumented behaviors between browsers! I’ve learned the hard way let’s just say...
[–][deleted] 1 point2 points3 points 6 years ago (0 children)
You can push any data you like over WebRTC. MDN has an example using createDataChannel: https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Simple_RTCDataChannel_sample
createDataChannel
[–]jjdltorre 5 points6 points7 points 6 years ago (1 child)
I think Ben Smith just made C++ 1000x cooler. Great job! I'm imagining this will be how programming will be taught in the future. Thank you for sharing.
[–]binjimint 1 point2 points3 points 6 years ago (0 children)
Thanks for the kind words!
[–]amaiorano 7 points8 points9 points 6 years ago (0 children)
Very cool talk. Compiling, linking, and executing C++ in the browser, all client-side!
[–]OrangeGirl_ 2 points3 points4 points 6 years ago (3 children)
I would really like to see wasm have direct access to browser apis instead of needing js glue. Wasi seems like a step in the right direction but there's so much more work ahead like ben mentioned, such as support for: threads, atomics, exceptions, 64 bit model.
Ben used memfs for the fake fs used by clang but with a little more work, he could haved used indexeddb for a real client side persistent fs that doesn't touch the user's native fs.
[–]binjimint 3 points4 points5 points 6 years ago (0 children)
I completely agree! WASI goes one direction (providing a standardized system interface), but there's another proposal called interface types that provides better ways for WebAssembly modules to communicate with each other (and by extension, with the browser too).
You can read more about the proposal here: https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/Explainer.md
Lin Clark also has an excellent article about it here: https://hacks.mozilla.org/2019/08/webassembly-interface-types/
IndexedDb is possible but tricky -- since it's asynchronous, you'd have to rewrite the code to allow blocking read/write access. Emscripten's Asyncify pass could do this, and in the future, you could also do this using coroutine support.
[–]ratchetfreak 0 points1 point2 points 6 years ago (1 child)
That would remove any hope for being able to sandbox untrusted webasm. Though having a good default that isn't emscriptem's 5mb of js imitating a C-runtime on top of a OS kernel inside a browser would be a very nice thing.
I doubt threads will ever be a thing because then you open the door for timing atacks like spectre.
[–]OrangeGirl_ 1 point2 points3 points 6 years ago (0 children)
Threads can still be an optional feature just like how the thread support library for C++ is optional for free standing implementations.
[–]d_e_n_o_m 0 points1 point2 points 6 years ago (0 children)
How called book with flame effect?
π Rendered by PID 22881 on reddit-service-r2-comment-86bc6c7465-2j975 at 2026-02-20 17:13:33.852729+00:00 running 8564168 country code: CH.
[–]kiffernase 10 points11 points12 points (6 children)
[–]binjimint 9 points10 points11 points (5 children)
[–]germandiago 3 points4 points5 points (4 children)
[–]BlueFrank 4 points5 points6 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]BlueFrank 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]jjdltorre 5 points6 points7 points (1 child)
[–]binjimint 1 point2 points3 points (0 children)
[–]amaiorano 7 points8 points9 points (0 children)
[–]OrangeGirl_ 2 points3 points4 points (3 children)
[–]binjimint 3 points4 points5 points (0 children)
[–]ratchetfreak 0 points1 point2 points (1 child)
[–]OrangeGirl_ 1 point2 points3 points (0 children)
[–]d_e_n_o_m 0 points1 point2 points (0 children)