摘要: NULL In C In C++98 In C++11 From the description of "cpluscplus reference" , we can see that NULL's definition is compiler dependent. In this blog, I 阅读全文
posted @ 2017-09-07 15:15 keviwu 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 不能重载的运算符 前两个运算符不能重载是为了保证访问成员的功能不能被改变,域运算符和sizeof 运算符的运算对象是类型而不是变量或一般表达式,不具备重载的特征。 只能重载为成员函数的运算符 因为这些运算符类本身就默认存在,不重载的话类会自动生成一个,比如"="运算符,假设有个class A, A 阅读全文
posted @ 2017-09-04 10:06 keviwu 阅读(129) 评论(0) 推荐(0) 编辑
摘要: cmake简介 在cmake出现之前,在linuxiax下,大型软件系统一般使用make来控制编译过程,而在Windows下可能是用vs下一个project来构建。一个复杂的系统本身依赖关系就很麻烦,如果想把一个linux下的项目拿到Windows下编译,我们可能要重新建立vs工程,这将是一项乏味且 阅读全文
posted @ 2017-09-03 20:38 keviwu 阅读(498) 评论(0) 推荐(0) 编辑
摘要: ```c++ include template int ArraySize (T (&arr)[N]) { //此处是数组的引用,在C语言中不支持 return N; } int main() { int x[10]; std::cout 阅读全文
posted @ 2017-05-27 09:13 keviwu 阅读(1554) 评论(0) 推荐(0) 编辑
摘要: see the following two examples, the conclusion is that we should define variable in the loop if it can. c++ //test1.cc outside the loop include int ma 阅读全文
posted @ 2017-05-14 21:43 keviwu 阅读(203) 评论(0) 推荐(0) 编辑
摘要: list stack of all threads 阅读全文
posted @ 2016-12-29 16:17 keviwu 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 语法: 说明: dynamic_cast用来执行继承体系中“安全的向下转型或跨系转型动作”, 也就是说你可以利用dynamic_cast,将指向基类的指针或引用转换为派生类的指针或引用。 style="color:green" 并得知转型是否成功。如果转型失败,返回NULL。 注意,dynamic_ 阅读全文
posted @ 2016-12-01 22:48 keviwu 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 进程的有效用户ID用于文件访问时的权限检查。通常,有效用户ID等于实际用户ID(也就是你登录是的用户ID),有效组ID等于实际组ID。 我们知道每个文件针对不同的user有不同的读、写、执行权限。当执行一个程序文件时,进程的有效用户ID通常就是实际用户ID。但是可以在文件模式字(st_mode)中设 阅读全文
posted @ 2016-11-26 18:01 keviwu 阅读(269) 评论(0) 推荐(0) 编辑
摘要: 1. 《C++ Primer》 用class和struct关键字定义类的唯一差别在于默认访问级别:默认情况下,struct的成员为public,而class的成员为private。 2. class关键字还可以用于定义模板类型,struct不可以。 c++ include class C0 { in 阅读全文
posted @ 2016-11-14 19:48 keviwu 阅读(551) 评论(0) 推荐(0) 编辑
摘要: C/C++中的函数指针 一、引子 今天无聊刷了leetcode上的一道题,如下: Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle va 阅读全文
posted @ 2016-10-03 22:27 keviwu 阅读(636) 评论(0) 推荐(0) 编辑