kit

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

6_5_32b_string_subscript_nonzero.c (375B)


      1 /* Subscripting a string literal at a nonzero offset should yield the byte
      2  * at that offset. Today the parser/cg path returns 0 for any index > 0
      3  * even though `"ab"[0]` and the same byte via `char s[] = "ab"; s[1]`
      4  * both work — the limitation is specific to a direct TOK_STR subscript
      5  * with a nonzero index. */
      6 int test_main(void) { return "ab"[1]; /* 'b' = 98 */ }