[Issue 3365] New: Safe casts: type modifiers
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 5 07:11:53 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3365
Summary: Safe casts: type modifiers
Product: D
Version: future
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dfj1esp02 at sneakemail.com
--- Comment #0 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> 2009-10-05 07:11:53 PDT ---
C++ has const_cast to add or remove const modifier from type. Currently in D
casting to/from const is unsafe as it doesn't protect from type conversions.
Safe variants of const casts can be added with the following syntax:
cast(const)obj; //to const-qualified
cast(~const)obj; //to mutable
cast(immutable)obj; //instead of assumeUnique
cast(~immutable)obj;
cast(shared)obj;
cast(~shared)obj;
I'm not sure whether cast(~const) should behave exactly as cast(~immutable).
P.S. This doesn't impose any additional requirement on the runtime library.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list