Thread overview | |||||
---|---|---|---|---|---|
|
January 11, 2008 [Issue 1781] New: Conditional Compilation - debug ( Integer ) is to restrictive | ||||
---|---|---|---|---|
| ||||
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@digitalmars.com ReportedBy: danijans03@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. -- |
January 18, 2008 [Issue 1781] Conditional Compilation - debug ( Integer ) is to restrictive | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1781 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement -- |
May 12, 2010 [Issue 1781] Conditional Compilation - debug ( Integer ) is to restrictive | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1781 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2010-05-12 03:01:50 PDT --- There is also this syntax: debug ( Identifier ) So you can use: debug(MEDIUM) Logger.writeDebug(""); To be compiled with: -debug=MEDIUM -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation