-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Work around msvc definition of NAN #702
Conversation
LoL, I took a stab at it here: #701 |
@@ -41116,7 +41116,7 @@ static const JSCFunctionListEntry js_number_funcs[] = { | |||
JS_CFUNC_DEF("isSafeInteger", 1, js_number_isSafeInteger ), | |||
JS_PROP_DOUBLE_DEF("MAX_VALUE", 1.7976931348623157e+308, 0 ), | |||
JS_PROP_DOUBLE_DEF("MIN_VALUE", 5e-324, 0 ), | |||
JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ), | |||
JS_PROP_U2D_DEF("NaN", 0x7FF8ull<<48, 0 ), // workaround for msvc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to define JS_FOLAT64_NAN like so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already exists and defined as follows :)
#define JS_FLOAT64_NAN NAN
edit: I suppose you're asking to change JS_FLOAT64_NAN? Won't work, you can't write it as a compile-time expression.
I initially named it JS_COMPILE_TIME_NAN
but then I thought "rule of three" and there are only two instances now.
Can you herry pick the 1st commit from #701 so we can test if this is it? |
That doesn't build/pass CI though, does it? |
The first commit is just the CI, which fails on master, if you add it here we'd know if your change fixes it :-) |
If this works you also want to add a "Fixes" for #622 |
NAN is reportedly no longer a compile-time expression in some versions of MSVC. Work around that by minting a NaN from a uint64. Fixes: quickjs-ng#622 Fixes: quickjs-ng#693
Oh, for posterity: another approach would have been to define them as e.g. |
I read in some other GH issue that that approach was no bueno for some reason with MSVC 🤷
TIL, makes sense! |
Let's test it: #704 :) |
Speaking of |
Not that I can see. I considered removing it but one thing at a time. |
NAN is reportedly no longer a compile-time expression in some versions of MSVC. Work around that by minting a NaN from a uint64.
Fixes: #693