Convert vmSymbols::SID to enum class

XMLWordPrintable

    • b21

      Convert vmSymbols::SID to enum class to provide better type safety.

      Also implement proper enumerators for this type of enums to avoid code like this (which might get out of bounds if you're not careful):

          for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
            vm_symbol_index[index] = (SID)index;
          }

      The new iteration style is:

          for (vmSymbolID index : vmSymbolsIterator()) {
            vm_symbol_index[as_int(index)] = index;
          }


      Also, implement type-safe casting from ints to SIDs, and vice versa.

            Assignee:
            Ioi Lam
            Reporter:
            Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: