QString::toLongLong() Bug?

Alles rund um die Programmierung mit Qt
Antworten
plip
Beiträge: 42
Registriert: 30. September 2008 16:37

QString::toLongLong() Bug?

Beitrag von plip »

Hallo,

wenn ich z.B. folgendes mache:

Code: Alles auswählen

 bool ok;
 QString binStr = "1000000000000000000000000000000000000000000000000000000000000000"; // 64 Zeichen
 qlonglong i = binStr.toLongLong(&ok, 2);
ist ok false und i 0. Das Problem tritt immer dann auf, wenn das oberste Bit gesetzt ist, also die Zahl negativ ist.
Ist das ein Bug oder steh ich total auf dem Schlauch?

Gruß
Philip
ScyllaIllciz
Beiträge: 200
Registriert: 9. Juli 2010 19:31

Re: QString::toLongLong() Bug?

Beitrag von ScyllaIllciz »

Schon mal

Code: Alles auswählen

#include <limits>
qDebug() << QObject::tr("%1").arg(std::numeric_limits<long long>::max(),0, 2);
probiert.
Antworten