buyuer commented on code in PR #7028:
URL: https://github.com/apache/incubator-nuttx/pull/7028#discussion_r964564019


##########
include/nuttx/nuttx.h:
##########
@@ -48,4 +48,83 @@
 #define container_of(ptr, type, member) \
   ((type *)((uintptr_t)(ptr) - offsetof(type, member)))
 
+/* Name: max_t
+ *
+ * Description:
+ *   return maximum of two values, using the specified type
+ *
+ * Arguments:
+ *   type - data type to use
+ *   x    - first value
+ *   y    - second value
+ */
+
+#ifndef max_t
+#define max_t(type, x, y) ({               \
+        type _max1 = (x);                  \
+        type _max2 = (y);                  \
+        _max1 > _max2 ? _max1 : _max2; })

Review Comment:
   Oh, I understand what you mean, this is indeed a problem. It can only work 
in the GCC compiler. If practical standard C, then it can only be implemented 
by functions, not macro. Do you have a good suggestion?



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to