Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
heywhatupboys
on Dec 19, 2022
|
parent
|
context
|
favorite
| on:
Checked integer arithmetic in the prospect of C23
> if (!chk_add(&x, a, b)) { > /* error! */ > }
does it return non-zero on success???
tinglymintyfrsh
on Dec 19, 2022
|
next
[–]
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.
comex
on Dec 19, 2022
|
parent
|
next
[–]
It returns a bool, but true means error, not false.
ronsor
on Dec 20, 2022
|
root
|
parent
|
next
[–]
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.
EdSchouten
on Dec 19, 2022
|
prev
[–]
It returns a boolean.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
does it return non-zero on success???