KCalc's Future

Andreas Pakulat apaku at gmx.de
Sat Dec 8 23:38:19 CET 2007


On 08.12.07 23:12:16, Christian Ehrlicher wrote:
> _knumfloat::_knumfloat(QString const & num)
> {
>   mpf_init(_mpf);
>   mpf_set_str(_mpf, num.toAscii(), 10);
> }
> 
> I already tried to pass "10,0" without success. Don't know if "nan" and
> "inf" is correctly interpreted.

Does gmp create a deep copy of the char*? If not that might be the
reason, toAscii() returns a QByteArray and that will be implicitly
converted to char*. However that returns the QByteArray internal buffer
and thus its gone after the call to mpf_set_str. So either gmp needs to
do a deep copy in set_str or you need to keep the QByteArray around
until its not needed anymore.

Andreas

-- 
Your boss is a few sandwiches short of a picnic.


More information about the release-team mailing list