C++26: A User-Friednly assert() macro

C++26 fixes assert — tiny tweak, big feelings, and a spelling roast

TLDR: C++26 makes assert() less fussy so devs can write checks without awkward extra parentheses, while keeping old code intact. Commenters split between cheering the convenience, demanding a deeper preprocessor fix, warning about assert pitfalls—and roasting a “Friednly” typo with meme energy, proving tiny changes still spark big feelings.

C++26 is giving the humble assert() a glow-up, letting it handle messy expressions without those extra “why am I doing this?” parentheses. The standard change (a small macro tweak under the hood) keeps old code working and still lets you attach messages with &&. Sounds boring? The comments turned it into a street fight.

The DIY crowd rolled in first: one dev waved a GitHub link and basically said, “who cares, just make your own assert.” Purists clapped back that the real problem is the C++ preprocessor itself—if it chokes on common code, fix the mouth, not the food. Meanwhile, the safety police showed up with sirens: if you hide side effects inside assert, they vanish when assertions are disabled, and suddenly your program’s “surprise!” moment is a crash.

Then came the memes. A misspelling in the headline (“Friednly”) triggered the line of the day: assert(spellcheck("Friednly"));. Pedants also reminded everyone that assert isn’t the only lowercase macro—hello, isnan. And the “contracts will replace asserts” crowd? The room mostly shrugged: that’s a someday feature; this fix helps today.

Verdict: a tiny change sparked a big vibe. Fans call it a quality-of-life win; skeptics call it duct tape; jokers call it Friednly—and they’re all loud.

Key Points

  • C++26 adopts a change to assert(), redefining it as a variadic macro using __VA_ARGS__.
  • The update fixes parsing fragility where assert broke with templates, lambdas, or brace initialization unless extra parentheses were added.
  • An earlier idea to support comma-separated diagnostic messages like static_assert was rejected during review.
  • The new design blocks top-level comma operator use in assert to avoid accidental always-true expressions; diagnostics should use && with a string literal.
  • The change is backward-compatible and asserts will remain useful even with future C++ contracts.

Hottest takes

"you can just define your own" — nyc_pizzadev
"Putting code with side effects into an assert is asking for trouble" — MontagFTB
"Shouldn't the preprocessor be fixed" — amelius
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.