You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/02/08 14:54:52 UTC

[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8471: fix visual studio Compiler Error

xiaoxiang781216 commented on code in PR #8471:
URL: https://github.com/apache/nuttx/pull/8471#discussion_r1100248072


##########
include/nuttx/lib/math.h:
##########
@@ -74,15 +74,45 @@
 
 /* General Constants ********************************************************/
 
-#define INFINITY    (1.0/0.0)
-#define NAN         (0.0/0.0)
-#define HUGE_VAL    INFINITY
+#ifdef _MSC_VER
 
-#define INFINITY_F  (1.0F/0.0F)
-#define NAN_F       (0.0F/0.0F)
+/* Workaround for Visual Studio(MSVC) Compiler Error C2124
+ *
+ * D:\archer\code\nuttx\libs\libc\stdlib\lib_strtod.c: error C2124:
+ *                                                     divide or mod by zero
+ *
+ * Windows MSVC restrictions, MSVC doesn't allow division through a
+ * zero literal, but allows it through const variable set to zero
+ *
+ */
+
+extern const double      __divzero_d;

Review Comment:
   __ to g_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org