2012年12月7日

摘要: 一出手,就写错误的代码。本想将整数转换成字符串,然后这样写:char buf[64];int num = 65;sprintf(buf, "%n", num);实际上应该是这样:sprintf(buf, "%d", num);查了一下,%n 是将当前 printf 已打印的字符数写入一个 int 指针。好久没用 c 了,慎之,慎之。 阅读全文
posted @ 2012-12-07 15:00 究生 阅读(1123) 评论(0) 推荐(0)

2012年11月27日

摘要: gcc is 'Gnu CompilerCollection'. If you pass it a C++ file, it will invoke the C++ compiler ('g++') behind the scenes.gcc is essentially the frontend for several compilers and the linker too.Edit:As several people pointed out, this doesn't mean that 'gcc' and 'g++' 阅读全文
posted @ 2012-11-27 10:56 究生 阅读(1543) 评论(0) 推荐(0)

2012年10月10日

摘要: 看一段代码:class Foo{ public: Foo() {}; Foo(int a) {}; void bar() {};};int main(){ // this works... Foo foo1(1); foo1.bar(); // this does not... Foo foo2(); foo2.bar(); return 0;}test.cpp:21: error: request for member ‘bar’ in ‘foo2’, which is of non-class type ‘Foo ()()’报错原因是,编译器把 Foo f... 阅读全文
posted @ 2012-10-10 10:29 究生 阅读(530) 评论(0) 推荐(0)

2012年9月14日

摘要: #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&)#define ARRAYSIZE(a) \ ((sizeof(a) / sizeof(*(a))) / \ static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))#define GTEST_COMPILE_ASSERT_(expr, msg) \ typedef ::t... 阅读全文
posted @ 2012-09-14 10:45 究生 阅读(286) 评论(0) 推荐(0)
摘要: C-x C-e 执行光标前面的一条语句选择一个 region, M-x eval-regionM-x load-file ~/.emacsM-x eval-buffer以上方法都是立即生效。例:在任何一个文件中,输入以下语句:(setq frame-title-format "emacs@%b")把光标停在在这条语句后面, C-x C-e ,即可看到 Emacs 的标题栏上发生了变化。这种方法非常适合调试小的配置 阅读全文
posted @ 2012-09-14 10:43 究生 阅读(464) 评论(0) 推荐(0)
摘要: io synchronous 同步,指应用调用完系统调用之后,只能等待返回结果io blocking 阻塞,指系统调用只有在IO操作完成后才能返回 阅读全文
posted @ 2012-09-14 10:40 究生 阅读(121) 评论(0) 推荐(0)
摘要: 开启服务rsync --daemon --config=/etc/rsyncd/rsyncd.conf查看列表rsync 10.6.50.133::备份 source 目录下的内容rsync -avz source/ liu@172.22.3.31::TEST/备份 source 目录rsync -avz source liu@172.22.3.31::TEST/ 常见错误 rsync: failed to connect to X.X.X.X: No route to host (113) rsync error: error in socket IO (code 10) at client 阅读全文
posted @ 2012-09-14 10:38 究生 阅读(905) 评论(0) 推荐(0)
摘要: 1 # ---------------------------------------------------------------- 2 # This is a makefile which automatically updates itself, 3 # using "$(CC) -MM -E" in linux. 4 # linliu 2011-04-25 5 # ---------------------------------------------------------------- 6 # $* 不包括扩展名的目标文件名称 7 # $+ 所有依赖文件,以 阅读全文
posted @ 2012-09-14 10:35 究生 阅读(210) 评论(0) 推荐(0)
摘要: ftp -n 10.6.50.134<<EOFuser test 123cd /home/yangguang/tace/source/tace/queryput RoutingPriority.hput RoutingPriority.cppbyeEOF 阅读全文
posted @ 2012-09-14 10:33 究生 阅读(137) 评论(0) 推荐(0)
摘要: 单引号' '目的: 为了保护文字不被转换.除了他本身. 就是说除去单引号外, 在单引号内的所有文字都是原样输出.echo '$*><!'输出:$*><!echo 'she is crying: "help"'输出:she is crying: "help"echo '\\\\'输出:\\\\echo 'hah 'test''输出:hah test # 略去了所有'echo ' today is `date`'输出 阅读全文
posted @ 2012-09-14 10:31 究生 阅读(211) 评论(0) 推荐(0)

导航