GLib: More checked arithmetic functions?


Hey people!

Recently I was looking for checked arithmetic functions in GLib and found the ones for guint, guint64 & gsize [0].

I also need them for signed integers and was wondering if:
(1) Only providing this limited set of unsigned variants is deliberate.
(2) More variants would be welcomed (wrapping compiler builtins or using [1] as fallbacks).

I would be happy to do the required work :slight_smile: .

Thanks already!

P.S.: I’m not sure if this is the right place to ask, as opposed to GLib’s Gitlab issue tracker. I’d be happy to move this somewhere else :slight_smile:.

[0] glib/gtypes.h · main · GNOME / GLib · GitLab
[1] INT32-C. Ensure that operations on signed integers do not result in overflow - SEI CERT C Coding Standard - Confluence

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.