News for hackers. Stuff that matters.
Re:C++26: A User-Friednly assert() macro by saagarjha on Saturday March 28, 2026 @09:03PM (#47559528)
No, the code that does this is always active
Re:C++26: A User-Friednly assert() macro by gottheUIblues on Saturday March 28, 2026 @09:20PM (#47559605)
Right so strictly speaking C++ could do anything here when passed a null pointer, because even though assert terminates the program, the C++ compiler cannot see that, and there is then undefined behaviour in that case
Re:C++26: A User-Friednly assert() macro by aw1621107 on Sunday March 29, 2026 @04:06AM (#47561248)
> because even though assert terminates the program, the C++ compiler cannot see that

I think it should be able to. I'm pretty sure assert is defined to call abort when triggered and abort is tagged with [[noreturn]], so the compiler knows control flow isn't coming back.

Re:C++26: A User-Friednly assert() macro by aw1621107 on Sunday March 29, 2026 @04:03AM (#47561237)
Shouldn't control flow diverge if the assert is triggered when NDEBUG is not defined? Pretty sure assert is defined to call abort when triggered and that is tagged [[noreturn]].
Re:C++26: A User-Friednly assert() macro by saagarjha on Sunday March 29, 2026 @04:19AM (#47561301)
Sorry, yes, I misread you