You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2023/01/02 14:46:27 UTC

[GitHub] [nuttx] hartmannathan commented on a diff in pull request #7992: modify the strtof

hartmannathan commented on code in PR #7992:
URL: https://github.com/apache/nuttx/pull/7992#discussion_r1060073187


##########
libs/libc/stdlib/lib_strtod.c:
##########
@@ -67,28 +67,106 @@
 #  define __DBL_MAX_EXP__ (1024)
 #endif
 
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+#define long_double long double
+#else
+#define long_double double
+#endif
+
+#define shgetc(f) (*(f)++)
+#define shunget(f) ((f)--)
+#define ifexist(a,b) if((*a) != NULL) {**(a) = (b);}

Review Comment:
   ```suggestion
   #define ifexist(a,b) do { if ((*a) != NULL) {**(a) = (b);} } while (0)
   ```



##########
libs/libc/stdlib/lib_strtof.c:
##########
@@ -69,28 +71,108 @@
 #  define __FLT_MAX_EXP__ (128)
 #endif
 
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+#define long_double long double
+#elif CONFIG_HAVE_DOUBLE
+#define long_double double
+#else
+#define long_double float
+#endif
+
+#define shgetc(f) (*(f)++)
+#define shunget(f) ((f)--)
+#define ifexist(a,b) if((*a) !=NULL)  {**(a) = (b);}

Review Comment:
   ```suggestion
   #define ifexist(a,b) do { if ((*a) != NULL) {**(a) = (b);} } while (0)
   ```
   
   Perhaps the duplicated macro(s) can be moved to a common header?



-- 
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