specifying __gc or not?

S

Serve Laurijssen

Is there a difference between the following cases?

using namespace System::Drawing;

Pen __gc *pen = new Pen(Color::Black);

//*******************************

using namespace System::Drawing;

Pen *pen = new Pen(Color::Black);
 
T

Tomas Restrepo \(MVP\)

Serve,
Is there a difference between the following cases?

using namespace System::Drawing;

Pen __gc *pen = new Pen(Color::Black);

//*******************************

using namespace System::Drawing;

Pen *pen = new Pen(Color::Black);

Not in this case, no. That's because in this case the compiler knows Pen is
a managed class, and thus will default to __gc pointers and __gc operator
new.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top