摘要:
1. install subversionaptitudeinstallsubversion2. check out source codecd~/<my_working_directory>svncohttps://code.ros.org/svn/opencv/trunk3. install cmakeaptitudeinstallcmake4.利用cmake产生makefile,新建一个folder,cd foldercmake-DCMAKE_BUILD_TYPE=RELEASE-DCMAKE_INSTALL_PREFIX=/usr/local sourcecode/path 阅读全文
2011年5月2日 #
2011年4月25日 #
摘要:
看了一个C源代码,这个C的lib广泛引用在包括firefox等很多地方看到如下的代码,百思不解staticintPTRCALLPREFIX(scanComment)(constENCODING*enc,constchar*ptr,constchar*end,constchar**nextTokPtr){if(ptr!=end){if(!CHAR_MATCHES(enc,ptr,ASCII_MINUS)){*nextTokPtr=ptr;returnXML_TOK_INVALID;}这函数定义,比较奇怪,突破我的知识范围了。我反复查了源代码,搞了一个多小时。所有的一切都是宏定义#ifndefP. 阅读全文
2011年4月24日 #
摘要:
intarrary[]={23,34,12,17,204,99,16};#defineTOTAL_ELEMENTS(sizeof(array))/sizeof(arrary[0])main(){intd=-1,x;if(d<=TOTAL_ELEMENTS-2){x=arrary[d+1]}}sizeof的返回类型是unsigned int。if语句中的,d由int类型被提升为unsigned int。结果-1变成正数255。if就不能被执行了。 总之,朝表示范围大的方向扩展:First, if either operand is long double, the other is con 阅读全文
2011年4月22日 #
摘要:
不能看网上视频,只能上adobe flash了sudoapt-getinstallflashplugin-nonfree安装stardict,现在不用装字典了,直接线上,可以用qq字典的?sudo aptitude install stardict 阅读全文
摘要:
一篇很好的文章,介绍函数指针。http://www.cprogramming.com/tutorial/function-pointers.htmlA function pointer is a variable that stores the address of a function that can later be called through that function pointer. This is useful because functions encapsulate behavior. For instance, every time you need a particu. 阅读全文
2011年4月18日 #
摘要:
It's considered safer because a lot of people have "heard" that it's safer and then told others, who now have also "heard" that it's safer. Not a single person who understands references will tell you that they're any safer than pointers, they have the same flaws 阅读全文
摘要:
Summary from answers and links below: A pointer can be re-assigned any number of times while a reference can not be reassigned after initialization. A pointer can point to NULL while reference can never point to NULLYou can't take the address of a reference like you can with pointersThere's 阅读全文
2011年4月16日 #
摘要:
#apt-getinstallbuild-essential#gcc-v#make-v 阅读全文
2011年4月14日 #
摘要:
#include<iostream>#include<string>usingnamespacestd;voidmale(){cout<<"I'maman.\n";}voidfemale(){cout<<"I'mawoman.\n";}struct{(void)(*fn)();constchar*key;}function_lookup_table[]={{&male,"male"},{&female,"female"},{NULL,N 阅读全文
2011年4月13日 #
摘要:
糊涂了很久,看了别人的解释,似懂非懂的。今天终于看了stackoverflow里面的解释。自己写了点程序验证了下,终于明白了。局部变量:作用域在一个block里例如if(ture){inti=0;}i就是局部变量,作用域就在大括号里。再看function(){i=0;}局部变量实质在存放在函数的栈中,每一次invoke函数,都会产生变量i,多次调用i之间是不受影响的。#include<iostream>voidf();intmain(){f();f();return0;}voidf(){std::stringlocalA;localA+="ab";std::co 阅读全文