Monday, January 07, 2008

Turning back @ C++ after very very long time...

After very long time, recently I tried to refresh my C++ skills. Though I never mastered C++ I have done some considerable amount of work. This includes 3D snake game using Direct X (Those good old days in college when I had lot of spare time to do these stuffs even wasting considerable amount of time !!!). I am a visual C++ beginner at that time. (no I am not a expert now.. now I don't know Visual C++ at all!) I downloaded Visual C++ express edition 2008, download was pretty fast despite downloaded file is some couple of 100 MB. Installed it and just opened it. Look and feel is really good, but started little slow (could be because of reading the feeds from Microsoft site to show on the start up page).

I created a new windows form application. I was expecting some huge code generation like MFC, but not. I tried to open the source code and found a following piece of code.

// Test.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"

using namespace Test;

[STAThreadAttribute] // <-- What is this? - 1
int main(array ^args) // <--- looks like a smiley - 2
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

// Create the main window and run it
Application::Run(gcnew Form1()); // gcnew ! gcnew - garbage Collector ! - 3
return 0;
}

I couldn't even understand syntactically some 3 lines.

1. Guess it could be annotation (I was working in Java for sometime)
2. Template based collection classes (Java generics equivalent)
3. gcnew - garbage collector - wow! garbage collector in Visual C++, cool!!!

These are my assumption, I will try to explore it a little more after sometime.. I felt definitely I need some exploration to understand these things. Let us see what I am upto!!!

Happy coding!

No comments: