kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

6_7_9_30_static_init_neg_float.c (556B)


      1 /* §6.7.9 -- the initializer for a static-storage object of arithmetic
      2  * type is an arithmetic constant expression (§6.6), which permits
      3  * unary `-` on a floating-constant. kit's `try_parse_static_float`
      4  * only accepts a bare TOK_FLT / TOK_NUM, so a leading `-` aborts with
      5  * "expected floating constant expression". Hits stb_sprintf's
      6  * `stbsp__negboterr` table, libm coefficient tables, and any numeric
      7  * library that ships negative constants. */
      8 static const double tab[2] = {-1.0, 43.0};
      9 
     10 int test_main(void) { return (int)(tab[0] + tab[1]); }