
C++
文章平均质量分 65
autoair
这个作者很懒,什么都没留下…
展开
-
如何在Word中插入代码片段
在Word中优雅的插入代码段,一键将你的代码转换成常见的代码格式。原创 2022-08-12 16:04:39 · 36819 阅读 · 26 评论 -
my instance of IDL
// File Video.idl import "oaidl.idl"; import "ocidl.idl"; [ object, uuid(318B4AD0-06A7-11d3-9B58-0080C8E11F14), helpstring("IVideo Interface"), pointer_default(unique) ] i原创 2005-08-18 10:33:00 · 739 阅读 · 0 评论 -
about #pragma
在所有的预处理指令中,#Pragma 指令可能是最复杂的了,它的作用是设定编译器的状态或者是指示编译器完成一些特定的动作。#pragma指令对每个编译器给出了一个方法,在保持与C和C++语言完全兼容的情况下,给出主机或操作系统专有的特征。依据定义,编译指示是机器或操作系统专有的,且对于每个编译器都是不同的。其格式一般为: #Pragma Para其中Para 为参数,下面来看一些常用的参数。 (1原创 2005-08-24 10:31:00 · 820 阅读 · 0 评论 -
enum data type
Enumeration Data TypeIDL supports enumerated types with syntax identical to that of their C counterpart, as in the following example:enum MYCOLOR {MYRED, MYGREEN, MYBLUE}; The enumeration can be used原创 2005-08-18 08:17:00 · 1471 阅读 · 0 评论 -
about 预处理
首先说明什么是预处理器1,首先说明什么是预处理器:预处理器指示符用"#"号标识,这个符号将放在程序中该行的最起始的一列上,处理这些指示符的程序称做预处理器(preprocessor)(通常捆绑在编译器中)#ifndef BOOK_STORE_H#define BOOK_STORE_H...#endif一个头文件可能会多次包含在一个源文件中,条件指示符可以防止这种头文件的重复处理;条件指示符#ifn原创 2005-08-19 11:53:00 · 1201 阅读 · 1 评论 -
syntax of IDL in detail
IDL SyntaxIt is time for us to start designing interfaces. The approach I have taken here is bottoms-up. We will first see how to define interface methods and related issues. Then we will take a look原创 2005-09-07 19:09:00 · 3707 阅读 · 1 评论 -
堆,栈,数组
链表与数组的区别A 从逻辑结构来看A-1. 数组必须事先定义固定的长度(元素个数),不能适应数据动态地增减的情况。当 数据增加时,可能超出原先定义的元素个数;当数据减少时,造成内存浪费。A-2. 链表动态地进行存储分配,可以适应数据动态地增减的情况,且可以方便地插入、 删除数据项。(数组中插入、删除数据项时,需要移动其它数据项)B 从内存存储来看B-1. (静态)数组从栈中分配空间原创 2005-10-31 14:51:00 · 1794 阅读 · 0 评论 -
林锐-高质量c/c++编程指南
返回主页高质量C++/C编程指南文件状态[ ] 草稿文件[√] 正式文件[ ] 更改正式文件 文件标识: 当前版本: 1.0作 者: 林锐 博士完成日期: 2001年7月24日版 本 历 史版本/状态 作者 参与者 起止日期 备注V 0.9草稿文件 林锐 2001-7-1至2001-7-18 林锐起草V 1.0正式文件 林锐 2001-7-18至2001-7-24 朱洪海审查V 0.9,林锐修正草原创 2005-11-20 13:30:00 · 6547 阅读 · 1 评论 -
about placement new syntax
Placement Syntax Arguments specifying an allocated storage location can be supplied to new by using the argument_list, also called the placement syntax. If placement arguments are used, a declaration原创 2005-11-17 19:02:00 · 861 阅读 · 0 评论 -
dynamic_cast
class CBase{public:int m_base;void SetBase(){m_base = 5;cout}virtual void func(){}};class CA:public CBase{public:int m_a;void SetA(){m_a = 6;cout}virtual void func(){cout}};class CB:public CBase{publi原创 2005-12-08 11:35:00 · 924 阅读 · 0 评论 -
macro again, hehe, more details and in chinese
说到宏,恐怕大家都能说出点东西来:一种预处理,没有分号(真的吗?)。然后呢?嗯.......茫然中......好吧,我们就从这开始说起。最常见的宏恐怕是#include了,其次就是#define还有.......还是从宏的用途分类吧:1、#include 主要用于包含引用文件,至今其地位无人能替代;2、注释掉代码。例如: #if 0 ....... #endif; 这种机制是目前注原创 2005-08-16 19:44:00 · 1238 阅读 · 0 评论 -
An example of MFC ( help myself with beginning in this field )
An Application Framework ExampleEnough generalizations. Its time to look at some code—not pseudocode but real code that actually compiles and runs with the MFC library. Guess what? Its the good old原创 2005-08-05 11:04:00 · 895 阅读 · 0 评论 -
something about Macro
1:#define 宏名 替换正文宏名必须是一个有效的C++标识符,“替换正文”可为任意字符组成的字符序列。2:#define TWO (ONE+ONE)带参数的宏。当替换正文要写多行时,行尾要加一个反斜线,表示宏定义继续到下一行。3:宏定义的替换正文可以为空。还有:4:#是把括号里面的变成字符串。 #define string(a) #acout编译结果是:cout5:##起粘接的作用。原创 2005-08-08 09:30:00 · 1136 阅读 · 0 评论 -
About typedef
Typedef NamesA typedef lets us define a synonym for a type: typedef double wages; // wages is a synonym for double typedef int exam_score; // exam_score is a synonym for int原创 2005-07-30 11:32:00 · 791 阅读 · 0 评论 -
about namespace using
名字空间指标志符的可见范围。自定义名字空间namespace A{class B{}}这样你的类只在这个名字空间里可见,如果别的地方想要使用你这里定义的B的话,必须加上int main(){using namespace A; B b;}或者加名字空间限定符 A::B b;这样就定义了一个B类型的对象。c++标准库中所有的标志符都被定义在一个名字空间std中,iostream也是标准库中的头文原创 2005-07-29 19:04:00 · 851 阅读 · 0 评论 -
About Enumerations
EnumerationsOften we need to define a set of alternative values for some attribute. A file, for example, might be open in one of three states: input, output, and append. One way to keep track of these原创 2005-07-30 11:40:00 · 822 阅读 · 0 评论 -
definition vs declaration of variables
A definition of a variable allocates storage for the variable and may also specify an initial value for the variable. There must be one and only one definition of a variable in a program.A declaration原创 2005-07-30 11:10:00 · 933 阅读 · 0 评论 -
About References!
ReferencesA reference serves as an alternative name for an object. In real-world programs, references are primarily used as formal parameters to functions. Well have more to say about reference param原创 2005-07-30 11:31:00 · 766 阅读 · 0 评论 -
Comparing Pointers and References
Comparing Pointers and ReferencesWhile both references and pointers are used to indirectly access another value, there are two important differences between references and pointers. The first is that原创 2005-07-30 12:40:00 · 832 阅读 · 0 评论 -
A Map instance
#pragma warning(disable:4786)//...#include #include //...#include using namespace std;class strmap1{ typedef std::mapstd::string, int> type_map; typedef type_map::iterator type_iter; type_m原创 2005-08-09 14:41:00 · 939 阅读 · 0 评论 -
about explicit
class A {public: A(); // default constructor};class B {public: explicit B(int x = 0, bool b = true); // default constructor; see below};原创 2005-08-09 17:26:00 · 953 阅读 · 0 评论 -
Two things to remind of using const
When replacing #defines with constants, two special cases are worth mentioning. The first is defining constant pointers. Because constant definitions are typically put in header files (where many diff原创 2005-08-10 10:29:00 · 949 阅读 · 0 评论 -
initialize the variables!!!
Uninitialized Variables Cause Run-Time ProblemsUsing an uninitialized object is a common program error, and one that is often difficult to uncover. The compiler is not required to detect a use of an u原创 2005-07-30 11:05:00 · 939 阅读 · 0 评论