www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20210] New: version blocks with boolean operators

https://issues.dlang.org/show_bug.cgi?id=20210

          Issue ID: 20210
           Summary: version blocks with boolean operators
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: black80 bk.ru

OT:
add to version check blocks some boolean operators
cuz next is more clear than indented monster at the bottom

version (Dip1000 || DIP1000 || dip1000) {
  pragma( msg, "D1000"); 
} else {
  pragma( msg, "no D1000"); 
}

// current state only supports && and !&&
version(A) version(B) { // replacement only for A && B
} else { /* !A || !B */ }

version (Dip1000) { 
    pragma( msg, "D1000"); // same logic many times
} else {
    version (DIP1000) {
        pragma( msg, "D1000"); 
    } else {
        version (dip1000) {
            pragma( msg, "D1000"); 
        } else {
            pragma( msg, "no D1000"); 
        }
    }
}

--
Sep 13 2019