QDataStream and long double
-
How do i save a long double? I tried this but it will crash when i save or load the file.
QDataStream &operator<<(QDataStream &out, long double data)
{
return out << data;
}QDataStream &operator>>(QDataStream &in, long double &data)
{
return in >> data;
}I tried to look it up, but no data.
-
Hi
long double is not directly supported.It crases as it will call itself over and over until stack overflow as
your function is the only operator << that takes a long double.But before you fight this more. please do
qDebug() << sizeof(long double);
qDebug() << sizeof(double);and see if it even matters as this is very much platform-dependent and might report the same size
and you can just use double. -
AUTOSAR-A0-4-2 rule for safety critical c++ applications:
Type long double shall not be used.
The width of long double type, and therefore width of the significand, is implementation defined.