News for hackers. Stuff that matters.
Re:Going Faster by Duplicating Code by logdahl on Wednesday October 11, 2023 @11:07AM (#37845401)
I kind of wish we had a form of preconditions/hints for the C compiler. There are lots of attributes, but those all look weird. Imagine annotating a calculation that 1 is a common value for example. or that a function is never called with a null-pointer.
Re:Going Faster by Duplicating Code by variadix on Wednesday October 11, 2023 @01:19PM (#37847359)
With GCC/clang you can write an ASSERT/ASSUME macro that does this. Basically: if (!cond) __builtin_unreachable();