Djgpp Bug with variable length funtion parameters
Posted: Mon Dec 08, 2003 7:25 am
Men,
I spent the whole day yesterday wondering why and debugging my printf that could not displaying the floating point variables I sent to it. Only to look at the object dump of my kernel and find out that Djgpp is the cause >:(
This is what I did,
void printf(unsigned char *format,...); // This the definition
I call my printf with
printf("%f",70.457);
Instead of Djgpp doing
push 0x428ce9fc
push [address of format string]
push [return address]
call _printf
Djgpp Now decides to
push 0x40519d3f
push [address of format string]
push [return address]
call _printf
which is WRONG!
I have called my float_to_string function defined
unsigned long float_to_string(float num,char * string);
which Djgpp handles properly.
push 0x428ce9fc
push [return address]
call _float_to_string
Now I wonder why Djgpp can't send floats properly when they are one of the parameters in a variable length parameter list (Other data types are sent properly)! ANY solutions to this please?
thanks
I spent the whole day yesterday wondering why and debugging my printf that could not displaying the floating point variables I sent to it. Only to look at the object dump of my kernel and find out that Djgpp is the cause >:(
This is what I did,
void printf(unsigned char *format,...); // This the definition
I call my printf with
printf("%f",70.457);
Instead of Djgpp doing
push 0x428ce9fc
push [address of format string]
push [return address]
call _printf
Djgpp Now decides to
push 0x40519d3f
push [address of format string]
push [return address]
call _printf
which is WRONG!
I have called my float_to_string function defined
unsigned long float_to_string(float num,char * string);
which Djgpp handles properly.
push 0x428ce9fc
push [return address]
call _float_to_string
Now I wonder why Djgpp can't send floats properly when they are one of the parameters in a variable length parameter list (Other data types are sent properly)! ANY solutions to this please?
thanks