6_7_9_31_static_init_const_float_expr.c (775B)
1 /* §6.7.9 / §6.6 -- a static-storage object of arithmetic type takes an 2 * arithmetic constant expression as its initializer. A *binary* operator 3 * applied to two floating constants is such an expression. kit's 4 * file-scope-init path only accepts a bare TOK_FLT / TOK_NUM (optionally 5 * with the unary `-` after 6_7_9_30 was fixed), so `1.0f/2.2f` aborts the 6 * declaration mid-list with "expected ';' after global declaration". 7 * Hits stb_image.h at the `static float stbi__h2l_gamma_i=1.0f/2.2f, 8 * stbi__h2l_scale_i=1.0f;` declaration. */ 9 static float a = 1.0f / 2.2f; 10 static float b = 1.0f; 11 12 int test_main(void) { 13 /* 1.0/2.2 ≈ 0.4545; (int)((a + b) * 10) should be 14. Add 28 so the 14 * exit code is the canonical 42. */ 15 return (int)((a + b) * 10.0f) + 28; 16 }