News for hackers. Stuff that matters.
Re:Checked integer arithmetic in the prospect of C23 by heywhatupboys on Monday December 19, 2022 @01:53PM (#34056017)
> if (!chk_add(&x, a, b)) { > /* error! */ > }

does it return non-zero on success???

Re:Checked integer arithmetic in the prospect of C23 by tinglymintyfrsh on Monday December 19, 2022 @02:15PM (#34056292)
They're using a bool, so it violates the old-school C paradigm used for library calls. This is more of a macro rather than a syscall or standard library function call.
Re:Checked integer arithmetic in the prospect of C23 by comex on Monday December 19, 2022 @02:25PM (#34056429)
It returns a bool, but true means error, not false.
Re:Checked integer arithmetic in the prospect of C23 by ronsor on Monday December 19, 2022 @11:41PM (#34061624)
It's not really an error. The function is just "check if this addition overflows" and tells you true, it does overflow, or false, it doesn't.
Re:Checked integer arithmetic in the prospect of C23 by EdSchouten on Monday December 19, 2022 @02:15PM (#34056288)
It returns a boolean.