|
From: | Paul Eggert |
Subject: | Re: checking against signed integer overflow |
Date: | Mon, 7 Dec 2020 11:35:22 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 |
On 12/6/20 4:05 AM, Bruno Haible wrote:
Hi Paul,I installed the attached patch to do thatVery nice! I made a tweak to the first example, to use printf() instead of print(). Hope you agree.Your reaction to the *_WRAPV names just goes to show how bad I am with marketing....This set of macros would be worth publicizing, e.g. through an announcement on planet.gnu.org. If you agree, we would 1) publish the current gnulib doc on www.gnu.org (as we do occasionally anyway) [I can do that], 2) write a news entry in https://savannah.gnu.org/projects/gnulib 3) approve it, also through https://savannah.gnu.org/projects/gnulib
Sure, here's a quick draft at a news entry.Gnulib's intprops module has new macros INT_ADD_OK, INT_SUBTRACT_OK, and INT_MULTIPLY_OK that support portable overflow checking while doing integer arithmetic. On GNU platforms the macros typically use only a single machine instruction more than ordinary integer arithmetic would.
[Prev in Thread] | Current Thread | [Next in Thread] |