Re: Problems with C floats

new topic     » goto parent     » topic index » view thread      » older message » newer message

Yep, I can reproduce the bug.

Looking at line 182 of be_callc.c it is not obvious to me what the cause of the bug is. The casting code looks correct...

I think printf() is a bad example however. See http://www.eskimo.com/scs/cclass/int/sx11c.html and http://en.wikipedia.org/wiki/Stdarg.h#Type_safety

"A float will automatically be promoted to a double."

So when dealing with vararg functions in C, one must always use C_DOUBLE and never C_FLOAT, or things break... likewise, never use C_CHAR or C_SHORT for varargs functions.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu