摘要: This keyword can only be applied to non-static and non-const data members of a class. If a data member is declared mutable, then it is legal to assign a value to this data member from a const member function.For example, the following code will compile without error because m_accessCount has been de 阅读全文
posted @ 2013-09-25 22:36 avexer 阅读(211) 评论(0) 推荐(0) 编辑
摘要: tolua++-1.0.93目前还尚不支持lua5.2,只能与lua5.1配合了(google code上有lua for windows,安装后再设置一下vc的include和lib目录即可)。然后再开始编译tolua,新建一个静态库的工程,src/lib目录下的文件拖进去,OK。tolua++.exe可以直接在网上下载,反正我自己懒得编译了(src/bin)。它的作用就是根据我们编写的pkg文件,生成一个cpp文件,我们再将这个生成的cpp文件拉进我们的工程一起编译。来个Demo:1. 先写个c++类:// hello.h#include class hello{public: vo... 阅读全文
posted @ 2013-09-22 20:24 avexer 阅读(384) 评论(0) 推荐(1) 编辑
摘要: 平时在读写文件时,我习惯了WIN32和C函数,今天试着用C++的风格来处理了一下。注意operator>中被我注释掉的代码,因为os#include struct user{ char name[32]; int age;};std::ostream& operator>(std::istream & is, user& user){ //is>>user.name>>user.age; is.read(user.name, sizeof(user.name)); is.read((char*)&user.age, sizeo 阅读全文
posted @ 2013-09-17 19:52 avexer 阅读(486) 评论(0) 推荐(0) 编辑
摘要: 1. ulimit -c查看当前系统配置的core dump文件大小限制。如果为0则进程崩溃时不会core dump2. ulimit -c unlimited无大小限制3. /proc/sys/kernel/core_uses_pid默认dump出的文件名就是core,可以修改该文件(0或1),如果为1,生成的文件名为core.pid4. /proc/sys/kernel/core_pattern这个文件可以配置core的生成目录(默认为崩溃进程所在目录)及文件名格式。5. gdb your_bin ./core 阅读全文
posted @ 2013-08-29 21:35 avexer 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1.auto关键字试想,曾经每次迭代vector之类的容器时,是否写了很长的迭代器类型声明:std::vector::iterator iter = vec.begin();好了,有了auto后可以直接这么写:auto iter = vec.begin();另外,auto还可以作为函数的返回类型,例如:templateauto add(const T1 v1, const T2 v2) -> decltype(v1 + v2){ return v1 + v2;}2.nullptr曾经,我们一般在初始化指针的时候都是直接初始化为0,现在可以用nullptr才初始化,就这方面来说它们是没有区 阅读全文
posted @ 2013-08-15 20:07 avexer 阅读(364) 评论(0) 推荐(0) 编辑
摘要: cmake -DCMAKE_BUILD_TYPE=Debug(或Release) 阅读全文
posted @ 2013-08-11 18:45 avexer 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1. thinkfanyaourt -S thinkfansudo systemctl enable thinkfan.service# edit /etc/thinkfan.conf (usedhttps://gist.github.com/4471319)sudo echo "options thinkpad_acpi experimental=1 fan_control=1" > /etc/modprobe.d/thinkfan.conf2. ldconfig3. sudo gedit /etc/default/rcSutc=yes ->utc=no4.s 阅读全文
posted @ 2013-08-07 12:54 avexer 阅读(214) 评论(0) 推荐(0) 编辑
摘要: This page gives an overview of the ThinkPad T430.Standard FeaturesOne of the following processors:2nd Generation Intel® Core™ i3-2328M (2.20 GHz, 3MB L3, 1333MHz FSB)2nd Generation Intel® Core™ i3-2370M (2.40 GHz, 3MB L3, 1333MHz FSB)2nd Generation Intel® Core™ i5-2520M (2.50 GHz, 3MB 阅读全文
posted @ 2013-08-07 12:01 avexer 阅读(300) 评论(0) 推荐(0) 编辑
摘要: #define xx(a) const char * _cstr##a = "xxxx";#define yy(a) #aint _tmain(int argc, _TCHAR* argv[]){ xx(bbb); std::cout xxxx std::cout fuck std::coutggggggg std::cout"hhhhhhhhhh\n\r\t"std::cout hhhhhhhhhh然后三个换行 return 0;}##一般在宏中构造一个变量名#用于产生一个字符串,跟在#后面的字符会作为字符串对待 阅读全文
posted @ 2013-08-06 11:56 avexer 阅读(204) 评论(0) 推荐(0) 编辑
摘要: pthread_cond_wait内部原子地完成了mutex unlock,睡眠当前线程(OS应该有一个队列,哪些线程因等待这个条件变量而阻塞)。如果这两步操作不是原子的话会有什么情况呢?假设第一步mutex lock已经完成时,此时另外一个线程就可以获得mutex,并且cond_notify,那么这个notify会丢失。这是本人的一些理解,若有错误望指出。 阅读全文
posted @ 2013-07-24 09:18 avexer 阅读(212) 评论(0) 推荐(0) 编辑