lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Dec 21, 2004, at 11:13, David Given wrote:

On Tuesday 21 December 2004 04:39, Brett Bibby wrote:

The
main issues are implicit type casting between double and float and long and ints. For example, on platforms like the PS2 you have to be really careful
that you don't accidentally enable emulated doubles.  Also, we have
denormal trouble on the PC when using Lua and DirectX together. Each time a new Lua is released we spend at least a full day fixing all the warnings.

But aren't you *allowed* to implicitly cast between double and float and long and int? Unfortunately I don't have my copy of the C standard here, but I'm reasonably sure that's all legal. Not meaning to quibble, but it sounds as if
your warnings are platform-specific, due to one of the C standard's
assumptions not being entirely true on your platform... can you quote a few?

Of course you are allowed to implicitly case between double and float. That's why it's a warning, not an error. You _allowed_ to write "if(x=0)", but it's still probably a mistake. Almost all warnings produces by all C compilers are for legal code (or code that could, in principle, be legal in some circumstances).

I remember one compiler (possibly Codewarrior?) that got very touchy with double to float conversion (and to be fair it is a big issue on some platforms, it's not always cheap to generate the correct code), even to the point of complaining about "float f = 1.0;"

David Jones