Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 657 Bytes

checked.mkd

File metadata and controls

23 lines (15 loc) · 657 Bytes

Checked Arithmetic

Based on existing compiler builtins, C23 will get type-generic functions for checked integer arithmetic to detect overflow in signed arithmetic.

#include <stdckdint.h>

int a = -1;
int b = ...
int c;
if (ckd_mul(&c, a, b))
  ... error ...