- 浏览: 202461 次
- 性别:
- 来自: 北京
最新评论
-
fuliang:
more cleanner than before
Big Integer Arithmetic -
yaojingguo:
Hi, Liang LiangThanks for the i ...
Redirect and restore stdout in C -
fuliang:
使用gcc编译.cpp,可以使用-lstdc++选项,这样gc ...
Redirect and restore stdout in C
文章列表
http://www.simple-talk.com/sql/t-sql-programming/a-case-for-canned-sql/
https://help.github.com/articles/using-ssh-agent-forwarding
http://www.unixwiz.net/techtips/ssh-agent-forwarding.html
To list .h and .ccp files, use: ls *.@(h|cc)
C++ inline
- 博客分类:
- C/C++
http://www.parashift.com/c++-faq-lite/inline-member-fns.html
Clone http://www.abc.com/refererence. Only follow links in directory /reference.
wget -k -m -I /reference http://www.abc.com/refererence.
Refer to http://stackoverflow.com/questions/471248/what-is-ultimately-a-time-t-typedef-to. Read Quassnoi's answer.
Customize NERD Commenter
- 博客分类:
- vim
NERD_commenter.vim:
\ 'c': { 'left': '// ', 'leftAlt': '/*', 'rightAlt': '*/' },
\ 'cpp': { 'left': '// ', 'leftAlt': '/*', 'rightAlt': '*/' },
A computer architecture can be seen as a turing machine. But how to express interrupt in turing machine?
I think that we can see interrupt a the flowing condition statement. This statement get executed whenever a instruction is executed.
if (condition_1)
condition_1 interrupt service rou ...
Find error or exception in a log file:
grep -i -E '((error)|(exception))' log
C symbol table
- 博客分类:
- C/C++
C source code:
#include <stdio.h>
void sub(int x)
{
}
void xiao()
{
static int x = 10;
sub(x);
}
void yu()
{
static int x = 20;
sub(x);
}
int main(int argc, const char *argv[]) {
return 0;
}
Run 'gcc' to compile it. Run 'nm -n' to give the following ...
C code:
struct person {
int age;
int no;
};
int plus_one(int no)
{
return no + 1;
}
int minus_one(int no)
{
return no - 1;
}
Run 'gcc -S -ffunction-sections -fdata-sections' produce:
.file "sec.c"
.section .text.plus_one,"ax",@progbits
.g ...
C code:
#include <stdio.h>
// change no's type from int to long long
long long func(long long no)
{
return no + 1;
}
int main(int argc, const char *argv[]) {
int i;
i = 100;
func(i);
return 0;
}
Run 'gcc -g' to compile it. Then run 'objdump -S a.out' produce:
...
gcov tutorial
- 博客分类:
- C/C++
tmp.c
#include <stdio.h>
int main(int argc, const char *argv[]) {
int i, j;
for (i = 0; i < 10; i++)
if (i > 100)
j += 3;
else
j += 2;
return 0;
}
Steps to run gcov:
jing@jingguolin:~/code/coverage$ gcc -fprofile-arcs -ftest-coverage tmp.c
j ...
Refer to http://os-blog.com/x86-64-assembly-programming-hello-world/.
Check /usr/include/unistd.h for system call numbers. Note that syscall numbers may be different for the same system call on 32 bit boxes and 64 bit boxes. Good luck!
#!/bin/bash
TEST1=$(cat <<_EOF_
Dogs and cats
living together
The world
Upside down
_EOF_)
echo "$TEST1"