Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-63281

Add support for case ranges via macro

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Service Arch

      As a GCC extension, you can write 'case ranges' in switch statements, e.g.

       

      switch (x) {
      case 1 ... 5:
         // etc
      } 

      It would be nice if we had a macro which allows us to use this extension. When the compiler supports the extension, it can use the syntax above, and when the compiler does not support it, it could expand to a series of 'case' labels.

       

      switch (x) {
      MONGO_CASE_RANGE(kSomethingMin, kSomethingMax):
         // etc
      } 

       

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: