本文共 527 字,大约阅读时间需要 1 分钟。
看程序:
#include看g++和stings:using namespace std;int main(){ char szTest[] = "abcxxx"; printf("defxxx\n"); return 0;}
taoge@localhost Desktop> g++ test.cpp && strings a.out | grep abcabcxxxtaoge@localhost Desktop> g++ test.cpp && strings a.out | grep defdefxxxtaoge@localhost Desktop> g++ test.cpp -O2 && strings a.out | grep abctaoge@localhost Desktop> g++ test.cpp -O2 && strings a.out | grep defdefxxxtaoge@localhost Desktop>
所以, 如果我们要对程序加入“印记”, 最好是用log形式(如printf), 而不是用char szTest[]方式。 总之, 是为了方便用strings准确鉴别出改动。
转载地址:http://hzwti.baihongyu.com/