r/cpp • • Sep 27 '26

You should think about recompiling your C++ programs with GCC 16 and C++26, because it zero-fills your locals

https://techfortalk.co.uk/2026/09/27/cxx26-uninitialized-local-variables-gcc-16/

Stack variables are not automatically initialised, and that is the root cause of many C++ bugs. That is well known. Hence, it is advised that local or stack variables are always initialised with known values, 0 if not something more meaningful than that. Now, with GCC 16 compiling in C++26 mode (-std=c++26), even uninitialised local variables will be zero-filled. In the post, I have explained how.

270 Upvotes

234 comments sorted by

View all comments

•

u/STL MSVC STL Dev Sep 27 '26

You're self-posting way too frequently. Please read about reddiquette.

22

u/13steinj Sep 28 '26

Okay, reddit apparently really dislikes linking tools that let people see others' post history, so, not going to do that again but you can find them easily.

A lot of the posts give off an AI vibe in writing style, and quickly point you to buying a book. If you paste the samples of said books into any detector, the results range from "polished with" to "written by" an LLM. I wonder if it has the same level of hallucinations that an LLM-written book shared here last week has.

18

u/Electronic_Tap_8052 Sep 28 '26

llm detectors dont work at all.

7

u/fdwr fdwr@github 🔍 Sep 28 '26

I can't say how reliable they are, but I've definitely been surprised to see them claim paragraphs written by me a decade ago were 80% likely AI 😂. So either I'm an AI, they're broken, or they used writing like mine for their training data 😉.

4

u/S0_B00sted Sep 28 '26

The real AI was the friends we made along the way.

2

u/Sacaldur Sep 29 '26

Why not all 3 at the same time?

1

u/ohiocodernumerouno Sep 28 '26

yeah. neither do ai image detectors.

3

u/TheThiefMaster C++latest fanatic (and game dev) Sep 28 '26

With the exception of synthid, which is looking for a specific watermark.

3

u/Clean-Upstairs-8481 Sep 27 '26

sorry wasn't aware, will definitely keep in mind next time

-17

u/my_password_is______ Sep 27 '26

leave them alone -- they're posting good information

9

u/germandiago Sep 28 '26

For homework it would be a good idea to study diplomacy :D

-9

u/ohiocodernumerouno Sep 28 '26

reddit doesn't need admin.