GardiZ Blog
Sunday, September 21, 2008
Thursday, May 03, 2007
Monday, April 30, 2007
VIM tips
Seven habits of VIM
Habit 1: Moving around quickly
/argc n, n, n ... => : set hlsearch *
=> Put :set hlsearch in .vimrc; use * again again
Habit 2: Don't type it twice.
type XpmCreatePixmapFromData() => type CTRL-N on word (word completion)
Habit 3: Fix it when it is wrong.
mis-spell => :iabbrev teh the
:syntax keyword WordError teh
Habit 4: A file seldom comes alone.
:!ctags -R
:tag init
:tnext
:grep "\" **/*.h <- search
:cnext
or gf => Go to file on header file names (work for http)
=> make sure the path option is set correctly.
[I => find the word under cursor to include files.
[ => Jump there.
Habit 5: Let's work together
Working with MsWord
=> set Vim with :set tw=0; wrap linebreak
Copy the text between app and Vim through clipboard.
Seven habits of VIM
Habit 1: Moving around quickly
/argc n, n, n ... => : set hlsearch *
=> Put :set hlsearch in .vimrc; use * again again
Habit 2: Don't type it twice.
type XpmCreatePixmapFromData() => type CTRL-N on word (word completion)
Habit 3: Fix it when it is wrong.
mis-spell => :iabbrev teh the
:syntax keyword WordError teh
Habit 4: A file seldom comes alone.
:!ctags -R
:tag init
:tnext
:grep "\
:cnext
or gf => Go to file on header file names (work for http)
=> make sure the path option is set correctly.
[I => find the word under cursor to include files.
[
Habit 5: Let's work together
Working with MsWord
=> set Vim with :set tw=0; wrap linebreak
Copy the text between app and Vim through clipboard.
Monday, April 16, 2007
Thursday, April 05, 2007
If we have a following block,
{
int i = 20;
int j = 40;
...
int k = i * j;
printf("k = %d, i = %d, j = %d\n", k, i, j);
}
Then the compiler would optimize this block in a way that i, j, and k variables never exist, since the block only uses values of them. Also, these values are within the scope of the block too. Thus, the compiler simply replaces the variables with constants. However, if the block ever uses reference or addresses, then it is illegal for compiler to optimize them. In this case, the compiler wouldn't optimize those variables away.
{
int i = 20;
int j = 40;
...
int k = i * j;
printf("k = %d, i = %d, j = %d\n", k, i, j);
}
Then the compiler would optimize this block in a way that i, j, and k variables never exist, since the block only uses values of them. Also, these values are within the scope of the block too. Thus, the compiler simply replaces the variables with constants. However, if the block ever uses reference or addresses, then it is illegal for compiler to optimize them. In this case, the compiler wouldn't optimize those variables away.
Subscribe to:
Comments (Atom)