<div class="__aliyun_email_body_block"><div  style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun"><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span >In the previous discussion, I tried to enable HAVE_OVERFLOW_CHECKS on msvc but failed.</span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span ><a  href="https://cm-mail.stanford.edu/pipermail/cmdist/2024-December/009360.html" target="_blank">https://cm-mail.stanford.edu/pipermail/cmdist/2024-December/009360.html</a></span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span ><br ></span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span >Since I have found that enable HAVE_OVERFLOW_CHECKS is expensive on MSVC, I decide to disable HAVE_OVERFLOW_CHECKS on Linux and macOS.</span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><br ></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;">And currently, it is not possible to disable HAVE_OVERFLOW_CHECKS:</div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><br ></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span >#ifndef HAVE_OVERFLOW_CHECKS</span><div  style="clear: both;">&nbsp; #if ((defined(__clang__) &amp;&amp; (!POINTER_32) &amp;&amp; ((__clang_major__ &gt; 3) || (__clang_major__ == 3 &amp;&amp; __clang_minor__ &gt;= 4))) || (defined(__GNUC__) &amp;&amp; (__GNUC__ &gt;= 5)))</div><div  style="clear: both;">&nbsp; &nbsp; #define HAVE_OVERFLOW_CHECKS 1</div><div  style="clear: both;">&nbsp; #else</div><div  style="clear: both;">&nbsp; &nbsp; #define HAVE_OVERFLOW_CHECKS 0</div><div  style="clear: both;">&nbsp; &nbsp; #pragma message("no arithmetic overflow checks in this version of s7")</div><div  style="clear: both;">&nbsp; &nbsp; /* these are untested */</div><div  style="clear: both;">&nbsp; &nbsp; static bool add_overflow(s7_int A, s7_int B, s7_int *C) {*C = A + B; return(false);}&nbsp; &nbsp; &nbsp; &nbsp; /* #define add_overflow(A, B, C) 0 */</div><div  style="clear: both;">&nbsp; &nbsp; static bool subtract_overflow(s7_int A, s7_int B, s7_int *C) {*C = A - B; return(false);} &nbsp; /* #define subtract_overflow(A, B, C) 0 */</div><div  style="clear: both;">&nbsp; &nbsp; static bool multiply_overflow(s7_int A, s7_int B, s7_int *C) {*C = A * B; return(false);} &nbsp; /* #define multiply_overflow(A, B, C) 0 */</div><div  style="clear: both;">&nbsp; #endif</div><span >#endif</span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span ><br ></span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;">Because it is actually controlled by the compiler and there is no way to disable the compiler flag without patching s7.c.</div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><br ></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;">Here is my suggestion:</div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;">#ifndef&nbsp;<span  style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">HAVE_OVERFLOW_CHECKS</span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;">// define&nbsp;<span  style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">HAVE_OVERFLOW_CHECKS to 0 or 1 according to compilers</span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span  style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">#endif</span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span  style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><br ></span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span  style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">#if&nbsp;<span >HAVE_OVERFLOW_CHECKS == 0</span></span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span  style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><span ></span></span><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;">&nbsp; &nbsp; static bool add_overflow(s7_int A, s7_int B, s7_int *C) {*C = A + B; return(false);}&nbsp; &nbsp; &nbsp; &nbsp; /* #define add_overflow(A, B, C) 0 */</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;">&nbsp; &nbsp; static bool subtract_overflow(s7_int A, s7_int B, s7_int *C) {*C = A - B; return(false);} &nbsp; /* #define subtract_overflow(A, B, C) 0 */</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;">&nbsp; &nbsp; static bool multiply_overflow(s7_int A, s7_int B, s7_int *C) {*C = A * B; return(false);} &nbsp; /* #define multiply_overflow(A, B, C) 0 */</div></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><span  style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><span >#endif</span></span></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><br ></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><br ></div><div  style="clear: both; font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><br ></div></div></div>