January 31, 2007 Preventing writes to a global struct instance with const? | ||||
---|---|---|---|---|
| ||||
Oops...I made a tiny mistake. Please see the corrected version below: I have an external variable declared like this: struct ControlID { uint signature; int id; }; extern extern (C) const ControlID kHIViewWindowContentID; But when I am able to write code like this without complaint from the compiler (GDC 0.21/DMD 1.00): kHIViewWindowContentID.signature = 123; I'd like to prevent that. Is such a thing possible? TIA, Rick |
Copyright © 1999-2021 by the D Language Foundation