Wednesday, March 31, 2010

Member Initialization List

Do you know "Member Initialization List"?

For example.

class CMyTestClassA
{
public:
int width;
int height;

CMyTestClassA(int a, int b) : width(a), height(b)
{
}

int getArea(void)
{
return (width*height);
}
};

It is same as belowing,

class CMyTestClassB
{
public:
int width;
int height;

CMyTestClassB(int a, int b)
{
width = a;
height = b;
}

int getArea(void)
{
return (width*height);
}
};

From the document, 1st class is faster than send class.

Tuesday, March 30, 2010

Can you guess the result?

Let's see

// example 1
int i =0;
int nResult =0;
for (i=0; i<100, i<0; i++)
{
nResult += i;
}
What is the result value of nResult?

// example 2
int i =0;
int nResult =0;
for (i=0; i<0, i<100,; i++)
{
nResult += i;
}
What is the result value of nResult?

Can you guess the result without compile of thoes code?

The answers are
example 1: nResult = 0
example 2: nResult = 4950

Your guess is right?

Column Mode in UltraEdit

In the source code, if you want to edit some block
for example

// test code
int MyArray[5] = {0x00,};
MyArray[0] = 0;
MyArray[1] = 1;
MyArray[2] = 2;
MyArray[3] = 3;
MyArray[4] = 4;

in the code you want to change the value, add 10 to all array. How can you change the source code?
if the array size is more than 10 or more

// test code
int MyArray[5] = {0x00,};
MyArray[0] = 10;
MyArray[1] = 11;
MyArray[2] = 12;
MyArray[3] = 13;
MyArray[4] = 14;

If you ues UltraEdit, ues "Column Mode" function. It is very powerful function.
How to use UltraEdit's powerful column mode

In the Visual Studio, Alt + Mouse Left, you can set block mark.

Friday, March 19, 2010

If you want to book mark in your PDF file,

If you want to bookmark in your PDF file and you ues Acrobat Reader,
please visit this website
http://www.aldenta.com/2006/09/15/plugin-bookmark-a-page-in-your-pdf/

Wednesday, March 17, 2010

grep for windows

If you want to use grep (that is a command line text search utility originally written for Unix) in the windows OS

1. Ues windows OS function: findstr
2. open source: Grep for Windows
3. Windows Grep
Or if you install cygwin, you can ues grep too.