[Issue 1781] New: Conditional Compilation - debug ( Integer ) is to restrictive

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 11 02:18:56 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1781

           Summary: Conditional Compilation - debug ( Integer ) is to
                    restrictive
           Product: D
           Version: 1.015
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: danijans03 at student.kau.se


It is currently not possible to write something like:

enum DebugLevel { LOW, MEDIUM, HIGH };
debug(DebugLevel.HIGH)
        Logger.writeDebug("");

I think it is to restrictive to only allow Integer. An enum could easily be
cast to an integer internally.

You could of course write something like:

const int DebugLevelLow = 0;
const int DebugLevelMedium = 1;
const int DebugLevelHigh = 2;
debug(DebugLevelHigh)
        Logger.writeDebug("");

But this isn't as elegant as using enums.


-- 



More information about the Digitalmars-d-bugs mailing list