You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/02/05 01:36:34 UTC

[GitHub] [trafficserver] SolidWallOfCode commented on pull request #7486: slice/Range: change maxval to use defined value instead of numeric_limits

SolidWallOfCode commented on pull request #7486:
URL: https://github.com/apache/trafficserver/pull/7486#issuecomment-773720287


   Why is that? I've never heard that claim before. Testing with g++ back to 8.3, `std::numeric_limits<in64_t>::max()` works as a `constexpr`, e.g. use of it causes a load immediate instruction, even at "-O0".
   
   If you want to be absolute certain, do this:
   ```
   #include <type_traits>
   static_assert(std::integral_constant<int64_t, Range::maxval>::value);
   ```
   If that compiles, it's a compile time constant.


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

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