10 2016 档案

摘要:注意编译的时候gcc -o * *.c -levent 需要加上-levent链接库 阅读全文
posted @ 2016-10-17 00:33 zzyoucan 阅读(792) 评论(0) 推荐(0) 编辑
摘要:wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz tar –xzvf libevent-1.4.13-stable.tar.gz cd libevent-1.4.13-stable ./configure --prefix=/h 阅读全文
posted @ 2016-10-17 00:19 zzyoucan 阅读(1539) 评论(0) 推荐(0) 编辑
摘要:private成员,也被继承下来,只是不能访问 阅读全文
posted @ 2016-10-16 12:15 zzyoucan 阅读(108) 评论(0) 推荐(0) 编辑
摘要://每次写代码总是被迭代器的iter->和*iter弄晕,主要是被protobuf弄晕了 #include struct test{ test(){ memset(this, 0, sizeof(test)); } int a; int b; }; int main() { test a, b; a.a = a.b = 0;... 阅读全文
posted @ 2016-10-15 11:49 zzyoucan 阅读(453) 评论(0) 推荐(0) 编辑
摘要:1.先用:ls -al /usr/lib | grep libevent 查看是否已安装,如果已安装且版本低于1.3,则先通过:rpm -e libevent —nodeps 进行卸载。 2.下载libevent安装包:libevent-1.4.13-stable.tar.gz,然后解压。 3.切换 阅读全文
posted @ 2016-10-12 23:33 zzyoucan 阅读(323) 评论(0) 推荐(0) 编辑
摘要:class Rational{ public: const Rational operator*( const Rational& rhs); Rational(int num); private: int a; }; Rational::Rational(int num) :a(num) { } const Rational Rational::operator*(... 阅读全文
posted @ 2016-10-11 23:58 zzyoucan 阅读(155) 评论(0) 推荐(0) 编辑
摘要:以前对于指针直接比较总是不放心,包括std::find用法总感觉不放心,后面发现这种用法是可以的 阅读全文
posted @ 2016-10-07 21:47 zzyoucan 阅读(178) 评论(0) 推荐(0) 编辑
摘要:#include void fun(int** a) { *a = 0;//改变指针的值 } void fun(int*& a) { a = 0;//改变指针的值 } int main() { int a = 90; int* p = &a; fun(p); return 0; } 阅读全文
posted @ 2016-10-07 21:39 zzyoucan 阅读(290) 评论(0) 推荐(0) 编辑
摘要:#include void fun(int* a, int num) { for (int i = 0; i < num; ++i) { std::cout << a[i] << " "; } } int main() { int a[5] = {0, 1, 2, 3, 4}; fun(a, 5);//数组名弱化为指针 retu... 阅读全文
posted @ 2016-10-07 21:24 zzyoucan 阅读(378) 评论(0) 推荐(0) 编辑
摘要:class A { public: virtual void f();//希望派生类重写 void fun();//绝大多数情况下不要重新定义基类的非虚函数,那样会打破公有继承Is-A的关系,而且行为诡异 }; class B : public A { }; int main() { A a; return 0; } 阅读全文
posted @ 2016-10-07 19:04 zzyoucan 阅读(119) 评论(0) 推荐(0) 编辑
摘要:发现还有好多c++很基础的细节问题,在写代码的时候时常困扰自己,有时间需要研究一下 阅读全文
posted @ 2016-10-07 10:58 zzyoucan 阅读(175) 评论(0) 推荐(0) 编辑
摘要:extern "C"{ #include #include #include } #include #include #include #pragma comment(lib,"lua.lib") void error(lua_State* L, const char* fmt, ...) { va_list argp; va_start(argp, fmt); ... 阅读全文
posted @ 2016-10-06 09:59 zzyoucan 阅读(331) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示