c++
南国小豆a
这个作者很懒,什么都没留下…
展开
-
c++添加定时器
1、在.h文件中添加头文件#include "SysWrap/Timer.h",类中添加定义SysWrap::CTimer *timer;2、在.cpp文件中查看所需要定时的函数在何处被调用,注释掉调用语句,添加timer = new SysWrap::CTimer("t");timer->start(SysWrap::CTimer::Proc(&你自己的类::&你自己定义的回调函数,原创 2016-04-23 16:35:03 · 859 阅读 · 0 评论 -
c++基础
1、strlen和sizeof的区别1.1 sizeof是算符,strlen是函数。 1.2 sizeof可以用类型做参数,strlen只能用char*做参数,且必须是以''\0''结尾的。1.3 数组做sizeof的参数不退化,传递给strlen就退化为指针了。 (函数参数的原因,sizeof是运算符,不是函数)1.4 大部分编译程序 在编译的时候就把sizeof计算原创 2016-07-02 10:20:29 · 180 阅读 · 0 评论 -
c++内存对齐的问题
#include typedef class{public:struct{int b;int c;}a;struct{bool e;char f;}d;}NEWTYPE;int main(){NEWTYPE *S = NULL;std::cout system("pause");return 0原创 2016-07-02 11:02:19 · 211 阅读 · 0 评论 -
union内存分配
网上的有一些说的不清楚,重新对网上程序修改,得出结论#includeunion{int i;char x[4];}a;int main(){a.x[0] = 10;a.x[1] = 1;a.x[2] = 0;std::cout // printf("%d\n", a.i);system("pause");return 0;原创 2016-07-02 11:42:56 · 376 阅读 · 0 评论