LiangliangSui opened a new issue, #2969:
URL: https://github.com/apache/fory/issues/2969

   ### Feature Request
   
   In C++, many defines are scattered across various header files (many of 
which are irrelevant to the current file),
   
   as follows:
   
   ```c++
   // https://github.com/apache/fory/blob/main/cpp/fory/util/logging.h#L27-L37
   // Force-inline attribute for hot path functions
   #if defined(__GNUC__) || defined(__clang__)
   #define FORY_ALWAYS_INLINE __attribute__((always_inline)) inline
   #define FORY_NOINLINE __attribute__((noinline))
   #elif defined(_MSC_VER)
   #define FORY_ALWAYS_INLINE __forceinline
   #define FORY_NOINLINE __declspec(noinline)
   #else
   #define FORY_ALWAYS_INLINE inline
   #define FORY_NOINLINE
   #endif
   ```
   
   
   ```c++
   // https://github.com/apache/fory/blob/main/cpp/fory/util/result.h#L30-L45
   //
   // GCC branch prediction hints
   //
   #if defined(__GNUC__)
   #define FORY_PREDICT_FALSE(x) (__builtin_expect(x, 0))
   #define FORY_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
   #define FORY_NORETURN __attribute__((noreturn))
   #define FORY_PREFETCH(addr) __builtin_prefetch(addr)
   #elif defined(_MSC_VER)
   #define FORY_NORETURN __declspec(noreturn))
   #define FORY_PREDICT_FALSE(x) x
   #define FORY_PREDICT_TRUE(x) x
   #define FORY_PREFETCH(addr)
   #else
   #define FORY_NORETURN
   #define FORY_PREDICT_FALSE(x) x
   #define FORY_PREDICT_TRUE(x) x
   #define FORY_PREFETCH(addr)
   #endif
   ```
   
   Should we consider moving these defines to a file like fory_def.h for 
unified management?
   
   ### Is your feature request related to a problem? Please describe
   
   _No response_
   
   ### Describe the solution you'd like
   
   _No response_
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to