D2.0: an example of use-case for casting invariant away
Daniel Keep
daniel.keep.lists at gmail.com
Mon Jun 18 01:19:02 PDT 2007
In addition to Brad's response, note that this is *not* "casting
invariant away". You are *adding* invariant[1]. This might be more
accurate:
extern(C) void initSomeSubsystem(char * initializationString);
int main()
{
invariant char * initString = "...";
// Cast away invariantness of initString so we can pass it to the C
// function; be it on your head if the function tries to change it!
initSomeSubsystem( cast(char*)initString );
}
-- Daniel
[1] Although it's already there, so it wouldn't have any effect, I don't
think.
More information about the Digitalmars-d
mailing list