tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] -__inf__ and -__nan__ are not constant


From: wizzwizz4
Subject: [Tinycc-devel] -__inf__ and -__nan__ are not constant
Date: Sun, 23 Jul 2023 14:11:02 +0000

I tried compiling QuickJS with tcc.
After setting `-DEMSCRIPTEN -DCONFIG_VERSION=""`, I get:

quickjs.c:2664: warning: function might return no value: 'JS_AtomGetKind'
quickjs.c:39834: error: initializer element is not constant

I'm guessing the error has something to do with this:

$ tcc -run -
a = { 1e1000 };
b = { -1e54 };
c = { __inf__ };
d = { +__inf__ };
e = { -1.0 / 0.0 };
f = { -__inf__ };
-:6: error: initializer element is not constant

For some reason, -__inf__ isn't considered a constexpr.
Neither is -1e320, or -__nan__.
Negating other float values, or not negating these ones, is fine.

(Reader note: __inf__ and __nan__ are TCC implementation details;
 in real programs, INFINITY and NAN from <math.h> should be used
 instead.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]