yyyyyyyyyyyyyyyyyyyy

博客园 首页 新随笔 联系 订阅 管理
上一页 1 ··· 257 258 259 260 261 262 263 264 265 ··· 367 下一页

2015年9月4日 #

摘要: c++ anonymous namespace -- 匿名空间 匿名空间,匿名类,匿名联合体,匿名结构体。 匿名空间 匿名空间 #include <stdio.h> namespace A { int ID = 1; } namespace { int ID = 11; } namespace B 阅读全文
posted @ 2015-09-04 01:41 xxxxxxxx1x2xxxxxxx 阅读(279) 评论(0) 推荐(0)

摘要: C++ operator overload -- 操作符重载 2011-12-13 14:18:29 分类: C/C++ 分类: C/C++ 操作符重载有两种方式,一是以成员函数方式重载,另一种是全局函数。 先看例子 #include <iostream> #include <string> usi 阅读全文
posted @ 2015-09-04 01:40 xxxxxxxx1x2xxxxxxx 阅读(266) 评论(0) 推荐(0)

摘要: c vs c++ in strcut and class 总习惯用c的用法,现在学习C++,老爱拿来比较。声明我用的是g++4.2.1 SUSE Linux。看例子吧 #include <iostream> #include <cstring> #include <string> using nam 阅读全文
posted @ 2015-09-04 01:40 xxxxxxxx1x2xxxxxxx 阅读(3140) 评论(0) 推荐(0)

摘要: c++ 类名和enum时重复时要在类名前加class:: 一些不好的习惯都是用小写,但又没有区分开token,看看代码再说,下面的代码是我在测试polymorphism时写的一部分,怎么也查不出,最后主意到下面红色标志出来的语句,他们(animal)重复了,要区分开来。 重复名的有很多情况,以后遇见 阅读全文
posted @ 2015-09-04 01:40 xxxxxxxx1x2xxxxxxx 阅读(397) 评论(0) 推荐(0)

摘要: C++ delete 和 delete [] 简单结论: new delete new [] delete [] 文章 : 对 delete [] 的声明 void operator delete[] (void* ptr) throw (); void operator delete[] (voi 阅读全文
posted @ 2015-09-04 01:39 xxxxxxxx1x2xxxxxxx 阅读(206) 评论(0) 推荐(0)

摘要: c/c++ unix ipc 一个例子 //c_unix.c #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> #define UNIX_DOMAIN "/tmp/UNIX.do 阅读全文
posted @ 2015-09-04 01:38 xxxxxxxx1x2xxxxxxx 阅读(209) 评论(0) 推荐(0)

摘要: address_space 从哪里来这两天想弄清楚linux的内存分配,忽然看到了address_space,就想弄明白。整个内核就见到 address_space(1)和address_space(2)在这个文件里出现。include/linux/compiler.h: # define __us... 阅读全文
posted @ 2015-09-04 01:38 xxxxxxxx1x2xxxxxxx 阅读(232) 评论(0) 推荐(0)

摘要: 引用与指针引用是C 中的概念,初学者容易把引用和指针混淆一起。一下程序中,n是m的一个引用(reference),m是被引用物(referent)。int m;int &n = m;n相当于m的别名(绰号),对n的任何操作就是对m的操作。所以n既不是m的拷贝,也不是指向m的指针,其实n就是m它自己。... 阅读全文
posted @ 2015-09-04 01:38 xxxxxxxx1x2xxxxxxx 阅读(107) 评论(0) 推荐(0)

摘要: c/c++可以有多个函数声明,但实现只能有一个 例子: //file t_defs.h #ifndef _T_DEFS_H_ #define _T_DEFS_H_ void say(void); #endif //file t_include.cpp #include #include "t_defs.h" ... 阅读全文
posted @ 2015-09-04 01:38 xxxxxxxx1x2xxxxxxx 阅读(278) 评论(0) 推荐(0)

摘要: linux下远程管理利器-tmux 1.控制键 控制键就是tmux的主键.当你在tmux环境下按下这个键的时候,tmux就会把你后面输入的指令,解析成它内置的功能.tmux默认的控制键是 ctrl+b(同时按下ctrl和b,在后面将直接用小写的c-b代替).这相当于screen的ctrl+a.同... 阅读全文
posted @ 2015-09-04 01:37 xxxxxxxx1x2xxxxxxx 阅读(268) 评论(0) 推荐(0)

上一页 1 ··· 257 258 259 260 261 262 263 264 265 ··· 367 下一页