boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

100-int-suffixes.c (528B)


      1 /* Integer literal suffixes per CC.md §Lexical syntax. */
      2 
      3 int main(int argc, char **argv) {
      4     long a = 1L;
      5     long long b = 2LL;
      6     unsigned int c = 3U;
      7     unsigned long d = 4UL;
      8     unsigned long long e = 5ULL;
      9     if (a + b + c + d + e != 15) return 1;
     10 
     11     /* Hex / octal */
     12     int h = 0x1F;        /* 31 */
     13     int o = 017;         /* 15 */
     14     if (h + o != 46) return 2;
     15 
     16     /* Mixed-case suffix */
     17     long long ll = 0x100ll;
     18     unsigned long long ull = 0xFFull;
     19     if (ll - ull != 1) return 3;
     20     return 0;
     21 }