C++ - Reddit
228 subscribers
48 photos
8 videos
25.3K links
Stay up-to-date with everything C++!
Content directly fetched from the subreddit just for you.

Join our group for discussions : @programminginc

Powered by : @r_channels
Download Telegram
cpp2 (cppfront) is over?

I haven't used cpp2 (cppfront) much, but I like the idea of it: consistent syntax, consistency of meta-programming (which is done in C++ too, I believe). Herb Sutter presented cpp2 (cppfront) as an experiment. He did not encourage other people to bet on it, exactly. And there wasn't much activity since 2022. Is the experiment over?

https://redd.it/1uxkglj
@r_cpp
fun fact about string literals i often forget:

String literals in c/c++ (const char*), support operator\[\] (in a compile time context)!

>constexpr char first = "test"[0\];
// i.e first = 't'

I think 90% of C developers would know this, but I figured maybe those of you who didn't start out with C might not have discovered this! I just recently used this in combination with an X macro for some debug ui code:

>// the x macro in question
\#define LIST_NOISE_PARAMS
X(heat)
X(rain)
X(cont)
X(grad)
X(hills)

I wanted to display the first letter of the noise parameter's name, in caps, followed by the noise value, i.e:

>H: 1.00
(the heat noise = 1.0f.)

>\#define X(VAR) UI::Text("{}: {:4.2f}",#VAR[0\]-('a'-'A'), sample.VAR);
LIST_NOISE_PARAMS
\#undef X

>// expands to:
UI ::Text("{}: {:4.2f}", "heat"[0\] \- ('a' - 'A'), sample.heat);
UI ::Text("{}: {:4.2f}", "rain"[0\] \- ('a' - 'A'), sample.rain);
// ...

>// which evaluates to:
UI ::Text("{}: {:4.2f}", 'H', sample.heat);
UI ::Text("{}: {:4.2f}", 'R', sample.rain);
// and so on for the rest of the list!

What other 'odd' C/c++ tricks/facts do you guys know/use? Personally, the X macro technique blew my mind when I first discovered it, and its probably the most legitimately useful 'trick' I know of. Pretty cool. Hopefully there are others in here that enjoy these little tidbits as much as i do.



https://redd.it/1uxwz1u
@r_cpp
A hardware-informed guide to Modern C++.

It explains how the source becomes instructions, how memory works, and why the machine cares about your choices.

If you're interested in systems programming, game engines, HFT, or writing fast software, give it a read.

read link

https://redd.it/1uyjnr5
@r_cpp
The WG21 2026-07 post-Brno mailing is now available

The 2026-07 post-Brno WG21 mailing has been published. You can browse and search the full set of papers, organized by working group, at wg21.org:

https://wg21.org/mailing/2026-07/

Source mailing: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/#mailing2026-07


https://redd.it/1uyluxq
@r_cpp
The WG21 2026-07 post-Brno mailing is now available

The 2026-07 post-Brno WG21 mailing has been published. You can browse and search the full set of papers, organized by working group, at wg21.org:

https://wg21.org/mailing/2026-07/

Source mailing: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/#mailing2026-07

https://redd.it/1uykv7y
@r_cpp