Home | History | Annotate | Download | only in enum_types
      1 //===-- main.c --------------------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 #include <stdio.h>
     10 #include <stdint.h>
     11 
     12 
     13 int main (int argc, char const *argv[])
     14 {
     15     typedef int16_t enum_integer_t;
     16     enum class DayType : enum_integer_t {
     17         Monday = -3,
     18         Tuesday,
     19         Wednesday,
     20         Thursday,
     21         Friday,
     22         Saturday,
     23         Sunday,
     24         kNumDays
     25     };
     26     enum_integer_t day_value;
     27     for (day_value = (enum_integer_t)DayType::Monday - 1; day_value <= (enum_integer_t)DayType::kNumDays + 1; ++day_value)
     28     {
     29         DayType day = (DayType)day_value;
     30         printf("day as int is %i\n", (int)day); // Set break point at this line.
     31     }
     32     return 0;
     33 }
     34