[Issue 1560] Skip switch warning for complete enum set

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 10 06:16:43 PDT 2007


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


smjg at iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com
           Keywords|                            |diagnostic




------- Comment #1 from smjg at iname.com  2007-10-10 08:16 -------
DMD 1.022 (Windows) reports both warnings at line 6.

The more significant bug here is that the second warning is complete nonsense,
not to mention that both messages suffer from issue 952.

There are a few issues at work here:
- as you say, all the enum values have been considered
- the second warning is complete nonsense

However, you could debate whether it should still issue the warning
nonetheless.  There are various reasons that an enum variable might contain a
value that isn't one of the named values, for example:
- it's a set of bit flags
- the enum's value list is incomplete (likely when interfacing OS or other
foreign APIs)
- some system of enums derived from enums is used to group them into categories
- malformed data read from a file

But should we assume that the programmer knows what he/she is doing in such
cases?


-- 



More information about the Digitalmars-d-bugs mailing list