Overview
Features
Download
Documentation
Community
Add-Ons & Services

Defines for MAX and MIN values of Poco types?

Please post support and help requests here.

Defines for MAX and MIN values of Poco types?

Postby deisenhut » 06 Aug 2013, 20:35

In Win32, there are defines for the maximum and minimum value of a data type. For example, for __int64 I can use the defines _I64_MIN and _I64_MAX to determine the minimum and maximum __int64 value.

In Poco, there is a "poco/types.h" header that includes various types mapped based on OS and architecture. For Win32, Poco::Int64 maps to __int64. On Linux(x64), Poco::Int64 maps to a signed long.

How do I determine the minimum and maximum values of a Poco type in a portable way?

Thanks,
Dan
deisenhut
 
Posts: 11
Joined: 30 Jul 2013, 00:11

Re: Defines for MAX and MIN values of Poco types?

Postby guenter » 07 Aug 2013, 09:49

Standard C++ has facilities for this:

Code: Select all
#include <limits>

...

std::cout << std::numeric_limits<Poco::UInt64>::max() << std::endl;
std::cout << std::numeric_limits<Poco::UInt64>::min() << std::endl;


See also: http://www.cplusplus.com/reference/limi ... ic_limits/
guenter
 
Posts: 1121
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Defines for MAX and MIN values of Poco types?

Postby deisenhut » 07 Aug 2013, 15:12

Great. Thanks.

Dan
deisenhut
 
Posts: 11
Joined: 30 Jul 2013, 00:11


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests