Preventing writes to a global struct instance with const?

Rick Mann rmann-d-lang at latencyzero.com
Wed Jan 31 11:21:14 PST 2007


I have an external variable declared like this:

struct
ControlID
{
	uint			signature;
	int				id;
};
extern extern (C) const HIViewID 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



More information about the Digitalmars-d-learn mailing list