PDA

View Full Version : Max and Min Values for qint64



gmat4321
23rd August 2010, 20:54
Are there constants that define the maximum and minimum values for a qint64?

ChrisW67
24th August 2010, 01:34
Your system might define LLONG_MIN and LLONG_MAX in climits (or limits.h). You could define them yourself:


const qint64 llong_max = Q_INT64_C(9223372036854775807);
const qint64 llong_min = Q_INT64_C(-(llong_max) - 1);
// const qint64 llong_min = Q_INT64_C(-9223372036854775808); Generates a warning in my compiler

Ginsengelf
24th August 2010, 08:24
Hi, since qint64 is just a typedef you should be able to use
std::numeric_limits < qint64 >::max() and ...min() to get the maximum/minimum.

Ginsengelf

ChrisW67
24th August 2010, 10:20
Indeed you can. I should have coffee before I visit these forums in the morning ;)