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

Add support for case ranges via macro

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Service Arch

    Description

      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
      } 

       

      Attachments

        Activity

          People

            backlog-server-servicearch Backlog - Service Architecture
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: