kit

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

ctl_ternary_chain.c (305B)


      1 /* A chain of nested ?: ternaries (a small jump-ladder of conditional selects).
      2  * volatile selector defeats folding so each compare/select round-trips.
      3  * sel==2 yields 42. */
      4 int test_main(void) {
      5   volatile int sel = 2;
      6   int r = (sel == 0) ? 10 : (sel == 1) ? 20 : (sel == 2) ? 42 : 99;
      7   return r;
      8 }