|
Hi there,
What is __gc statment before defining classes in manged code ?
It's my first post in managed code form
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
__gc tells the compiler that what follows next is a managed type, ie it will be garbage collected.
HTH,
James
Simplicity Rules!
|
|
|
|
|
Thanks for help
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
In MC++ should we always delete the destructor and the implement the Finalize function or we should never do anything?
I am still a little confused about if to leave the desctructor or not
Experts?!!?
Al
|
|
|
|
|
If it behaves like C# the destructor is treated as a Finalize method.... Wonder what would happen if you define both
James
Simplicity Rules!
|
|
|
|
|
The question may also be: What happens if I don't define a destructor what so ever?
Al
|
|
|
|
|
In a pure managed class it will be GC'd as normal... The destructor is just there to free up any non-managed resources during GC. If you do have unmanaged resources though you are encouraged to implement IDisposable so that they can be returned ASAP.
I have no idea what happens when you mix managed/unmanaged together though I assume you could treat it like another system resource, implementing IDisposable and calling Dispose from the destructor/finalize methods.
James
Simplicity Rules!
|
|
|
|
|
So, if I don't have any unmanaged code I could just delete the destructor! Great!
Thanks James!
Al
|
|
|
|
|
Albert Pascual wrote:
So, if I don't have any unmanaged code I could just delete the destructor! Great!
That's what it's called Managed C++. Part of the "managed" is about garbage collection.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I use a lot of vectors for storing pointers to C++ objects. What is the best .NET framework collection type to use in Managed C++ for storing managed classes?
Michael
Communication is the first step towards enlightenment.
|
|
|
|
|
ArrayList is the analogy to vector...
BUT, if you feel adventurous you can get Collection Generator from Chris Sells and create a new template for MC++ (and modify the code so that it works with MC++), then you just create/edit an XML document to create a new Collection type.
Works very well with C#; haven't tested VB.NET's version. Comes with collections for Vectors and HashTables.
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
ArrayList is the analogy to vector...
Thanks for that. I'll have a read up on it.
James T. Johnson wrote:
BUT, if you feel adventurous you can get Collection Generator from Chris Sells and create a new template for MC++
Now this sounds interesting, I will have to go and have play. Thanks for the link.
Michael
Communication is the first step towards enlightenment.
|
|
|
|
|
I'd like to thank Chris for giving us all the MC++ forum as well as Albert who was solely responsible for bringing this idea up.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Nish [BusterBoy] wrote:
Albert who was solely responsible for bringing this idea up
Not quite...
cheers,
Chris Maunder
|
|
|
|
|
Chris Maunder wrote:
Not quite...
Oh! Sorry, but I thought it was Albert who first brought it up.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Sweet!
What a surprise when I saw the forum! Chris thanks so much! That was quick.
Now all my questions about MC++ will be answered!
There are so many questions I have that I need to get them in order and post them when I get some time!
Thanks Nish for backing me up all the way!
Al
|
|
|
|
|
Albert Pascual wrote:
Thanks Nish for backing me up all the way!
N/P. I've always wanted an MC++ forum too
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
First post
Expect more posts from me as I try to learn MC++ after the screensaver is done
James
Simplicity Rules!
|
|
|
|
|
2nd
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
01001001 00100000 01110011 01100101 01100101 00100000 01110011 01110100 01110101 01110000 01101001 01100100 00100000 01110000 01100101 01101111 01110000 01101100 01100101
|
|
|
|
|
Matt Newman wrote:
2nd
If I was 2nd, I'd have been so embarassed, I'd keep quiet about it. It's either 1st or nothing.
Jus kidding Matt
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Nish [BusterBoy] wrote:
If I was 2nd, I'd have been so embarassed, I'd keep quiet about it. It's either 1st or nothing.
I still beat you
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
01001001 00100000 01110011 01100101 01100101 00100000 01110011 01110100 01110101 01110000 01101001 01100100 00100000 01110000 01100101 01101111 01110000 01101100 01100101
|
|
|
|
|
...while i pour Hot Grits down Natalie Portman.
Thank you.
:rubs eyes:
oh, wait... sorry...
--------
all the modern things
have always existed
they've just been waiting
to come out
and multiply
and take over Björk, The Modern Things
|
|
|
|
|
LOL
James
Simplicity Rules!
|
|
|
|
|
Dude - wrong forum
cheers,
Chris Maunder
|
|
|
|
|
James T. Johnson wrote:
I try to learn MC++
That sounds good. I can now pester you with MC++ doubts and questions
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|