Hello,

i have fixed the Warnings from g++4.5 if -Wold-style-cast flag is activated.
Please refer the attached patch:

Index: ttmath/ttmathint.h
============================================================ =======
--- ttmath/ttmathint.h (Revision 303)
+++ ttmath/ttmathint.h (Arbeitskopie)
@@ -504,7 +504,7 @@
}

uint rem;
- uint c = UInt<value_size>::DivInt((uint)ss2, &rem);
+ uint c = UInt<value_size>::DivInt(static_cast<uint>(ss2), &rem);

if( ss1_is_sign != ss2_is_sign )
SetSign();
Index: ttmath/ttmath.h
============================================================ =======
--- ttmath/ttmath.h (Revision 303)
+++ ttmath/ttmath.h (Arbeitskopie)
@@ -2782,7 +2782,7 @@
template<class ValueType>
ValueType Factorial(const ValueType & x, ErrorCode * err = 0)
{
- return auxiliaryfunctions::Factorial2(x, (CGamma<ValueType>*)0, err, 0);
+ return auxiliaryfunctions::Factorial2(x, static_cast< CGamma<ValueType>* >(0), err, 0);
}


Index: ttmath/ttmathuint.h
============================================================ =======
--- ttmath/ttmathuint.h (Revision 303)
+++ ttmath/ttmathuint.h (Arbeitskopie)
@@ -2121,7 +2121,7 @@
{
// v.table[n-1] is != 0

- uint bit = (uint)FindLeadingBitInWord(v.table[n-1]);
+ uint bit = static_cast<uint>(FindLeadingBitInWord(v.table[n-1]));
uint move = (TTMATH_BITS_PER_UINT - bit - 1);
uint res = table[value_size-1];
d = move;
Index: ttmath/ttmathbig.h
============================================================ =======
--- ttmath/ttmathbig.h (Revision 303)
+++ ttmath/ttmathbig.h (Arbeitskopie)
@@ -2902,7 +2902,7 @@
void FromUInt(UInt<int_size> value)
{
info = 0;
- sint compensation = (sint)value.CompensationToLeft();
+ sint compensation = static_cast<sint>(value.CompensationToLeft());

return FromUIntOrInt(value, compensation);
}
@@ -2923,7 +2923,7 @@
is_sign = true;
}

- sint compensation = (sint)value.CompensationToLeft();
+ sint compensation = static_cast<sint>(value.CompensationToLeft());
FromUIntOrInt(value, compensation);

if( is_sign )
@@ -3626,7 +3626,7 @@
sint move; // how many times move the mantissa
UInt<man+1> man_temp(mantissa); // man+1 for moving
new_exp = exponent;
- new_exp.DivInt((sint)bits, move);
+ new_exp.DivInt(static_cast<sint>(bits), move);

if( move != 0 )
{

I hope you like my patch :-).
I have run your unit tests with success after my changes.

Best regards

Ettl Martin

Added by: tomek, 2010 IX 07

Why to change this? don't you like old-style casting? :)

Added by: ~guest, 2010 IX 08

I do not like it, because c++ offers better special cast operations for each specifc case: e.g.: static_cast, dynamic_cast, reinterpret_cast etc..

Added by: tomek, 2010 IX 15

Why do you think they are better? Do they better cast? I agree that e.g. const_cast takes some information, but what is really better in such an example:

sint compensation = (sint)value.CompensationToLeft();

and

sint compensation = static_cast<sint>(value.CompensationToLeft());

Is the latter case really better? Convince me pls.