SQLite User Forum

Compilation error on MSVC when using strict floating-point behavior
Login

Compilation error on MSVC when using strict floating-point behavior

(1) By anonymous on 2020-03-28 09:57:30 [source]

Hi,
on Windows 8.1, with Visual Studio 2013 installed, I can successfully compile SQLite 3.31.1 from the amalgamation as a 64-bit DLL from the command line with nmake.
However, if I pass the /fp:strict flag to the compiler I get this error:
    sqlite3.c(22158) : error C2099: initializer is not a constant

The flag behavior is explained at:
https://docs.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior

I frankly have no idea if it's worth fixing, I just have the habit to use this flag with my own code and so I tried to use it also with SQLite.

(2) By Richard Hipp (drh) on 2020-03-28 12:08:53 in reply to 1 [link] [source]

I would call this a compiler bug, since the fix make no difference in the generated binary and arguably makes the code less readable. Nevertheless, the problem should now be resolved on trunk.