开发者

What is the Linux equivalent to MAXDWORD?

In Microsoft Visual C++, there is a constant called MAXDWORD defined in winnt.h as follows:

#define MAXDWORD 0xffffffff

It开发者_运维技巧's useful as a high initial value for a 'double' when one is searching for the lowest value in a collection. Google though I might, I can't find the equivalent in standard headers on Linux, but I'm willing to bet there must be one.

I'm using:

  • uBuntu 10.04 64bit
  • g++ 4.4.3


Standard solution is to use std::numeric_limits. For instance, std::numeric_limits<long>::max(). You could use any standard type instead of long there. You even can to specialize numeric_limits for custom types.


#  define UINT_MAX  4294967295U

Found in /usr/include/limits.h

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜