Usage of INT_MAX, etc.

Thiago Macieira thiago at kde.org
Tue Oct 24 20:52:38 BST 2006


Simon Hausmann wrote:
>From Qt's perspective INT_MAX and friends are perfectly fine. Don't look
> at qinputdialog.h as reference :). limits.h is included in various
> public header files and for example qlayoutitem.h uses INT_MAX.
>
>I don't think another level of indirection buys us anything here :)

There's also std::numeric_limits<T>, which may be easier to use if you 
don't know what your q-type is.

For instance:
	std::numeric_limits<qulonglong>::max()
works, even if you don't know if qulonglong should be ULONG_MAX or 
ULLONG_MAX.

#include <limits>

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061024/6f96fbc9/attachment.sig>


More information about the kde-core-devel mailing list