D2.0: an example of use-case for casting invariant away
eao197
eao197 at intervale.ru
Mon Jun 18 00:21:34 PDT 2007
Hello!
It is a question only for clarification for myself. If I understand
http://www.digitalmars.com/d/final-const-invariant.html correctly the
casting invariant away allowed for situations like this:
// An interface for some third-party library
// (which is probably written in some exotic language).
extern(C) void initSomeSubsystem( char * initializationString );
...
// Our D2.0 stuff.
int main()
{
invariant char* initializationString = "...";
// Casting invariant away is necessary here.
initSomeSubsystem( cast(invariant) initializationString );
}
Am I correct?
--
Regards,
Yauheni Akhotnikau
More information about the Digitalmars-d
mailing list