Thread overview |
---|
February 14, 2008 [Issue 1833] New: std.c.windows.windows should use enums for constants, or be more selective about use of extern(Windows) | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1833 Summary: std.c.windows.windows should use enums for constants, or be more selective about use of extern(Windows) Product: D Version: 1.025 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla@digitalmars.com ReportedBy: wbaxter@gmail.com The phobos module std.c.windows.windows defines many constants like so: extern(Windows) { ... const DWORD MAILSLOT_NO_MESSAGE = cast(DWORD)-1; ... } This is a bad practice because A) all those constants bloat the executables. Using an enum instead fixes that. B) consts with Windows linkage are mangled without their module name, so if any other module defines the same constant with Windows linkage, the linker will complain of duplicate symbols. This can be fixed either by using enums or by not putting such constants in extern(Windows) blocks. B may not seem like such a big deal, but a number of fairly high-profile projects (Tangobos and DFL for example) contain copies of std.c.windows.windows that are modified slightly in one way or another. The copied versions of std.c.windows.windows should be fixed too, but Phobos should provide a good example of the "right" way to handle constants to begin with. -- |
March 04, 2008 [Issue 1833] std.c.windows.windows should use enums for constants, or be more selective about use of extern(Windows) | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1833 ------- Comment #1 from bugzilla@digitalmars.com 2008-03-04 02:25 ------- Not all the const declarations can be converted to enums with D 1.0, but I'll do all that can be. -- |
March 04, 2008 [Issue 1833] std.c.windows.windows should use enums for constants, or be more selective about use of extern(Windows) | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1833 ------- Comment #2 from wbaxter@gmail.com 2008-03-04 03:11 ------- (In reply to comment #1) > Not all the const declarations can be converted to enums with D 1.0, but I'll do all that can be. > Thanks. Please use extern(D) on the ones that can't be made enums. -- |
March 04, 2008 [Issue 1833] std.c.windows.windows should use enums for constants, or be more selective about use of extern(Windows) | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1833 ------- Comment #3 from wbaxter@gmail.com 2008-03-04 04:32 ------- (In reply to comment #2) > (In reply to comment #1) > > Not all the const declarations can be converted to enums with D 1.0, but I'll do all that can be. > > > > Thanks. Please use extern(D) on the ones that can't be made enums. ...unless you've got some good reason why they shouldnt' be extern(D), of course. -- |
March 07, 2008 [Issue 1833] std.c.windows.windows should use enums for constants, or be more selective about use of extern(Windows) | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1833 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #4 from bugzilla@digitalmars.com 2008-03-07 00:29 ------- Fixed dmd 1.028 and 2.012 -- |
Copyright © 1999-2021 by the D Language Foundation