NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Warning (level 1) C4303

C-style cast from 'type1' to 'type2' is deprecated

C-style type casting is not supported when using Managed Extensions for C++. To cast, use either dynamic_cast Operator or static_cast Operator. The following sample generates C4303:

#using <mscorlib.dll>

__gc struct A {
};
__gc struct B {
};

void main() {
   B *b = new B;   
   
   // old 'c' style cast, warning C4303
   A *a = (A*)b;

   // use the line below to resolve the warning
   // A *a = dynamic_cast<A*>(b);
}