Managed C++ value types and managed pointers.

cpp.net United States
  • 14 years ago
    hi,
    I am basically a C++ and C# programmer and a beginner in the field of Managed C++.NET

    I have few doubts, please pardon me if they seem senseless or absurd.

    1) What is the difference between a managed pointer and unmanaged pointer, apart from _gc and _nogc syntax??

    I want to know the way these pointer are allocated and how they work exactly. In main function and when defined as a part of managed and unmanaged classes.

    2) In a book i read...

    Besides being allocated on stack, value types can be allocated on unmanaged C++ heap using the __nogc new operator, but cannot be allocated on managed heap using the __gc new operator unless you define a managed pointer to value type.

    could not understand the above marked part. How can we actually define a managed pointer to a value type??

    3) In another article i read...

    Pointers to value types are managed by default.

    means if i define my _value struct or class, the pointers to them will be managed?? howcome, Managed pointers can point to value types?? Confused [*-)]

    I request a fair explanation and also links to some good artciles which can answer and explain me these things in detail.

    thanks in advance.Smiley Face [:)]






















Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry