c/c++
文章平均质量分 81
yqdm_zju
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++笔记
C++告诉我们在回收用 new 分配的单个对象的内存空间的时候用 delete,回收用 new[] 分配的一组对象的内存空间的时候用 delete[]。 楼主的这个问题提得很好。很多人注意到了这个问题,但是却不清楚为什么要这样做,不这样做行不行。 关于 new[] 和 d原创 2011-09-08 20:24:07 · 303 阅读 · 0 评论 -
effective C++ (Item2) Prefer <iostream> to <stdio.h>
type safety and extensibility are cornerstones of the C++ way of life. int i;Rational r;cin >> i >> r;cout if this code is to compile, there must be functions operator >> and operator ther原创 2011-11-03 23:52:00 · 854 阅读 · 0 评论 -
Effective C++(Item1) Prefer const and inline to #define
1 compare const and #define This can be called perfer the compiler(编译器) to the preprocessor(预处理器) #difine ASPECT_RATIO 1.098the symbolic name ASPECT_RATIO may never be seen by compilers;it may原创 2011-11-03 01:27:03 · 2995 阅读 · 4 评论 -
深入理解计算机系统 Number1
(1) The source program is a sequence of bits, each with a value of 0 or 1, organized in 8-bit chunks called bytes. Each byte represents some text character in the program.(2) Most modern systems re原创 2011-11-18 23:49:18 · 966 阅读 · 0 评论 -
VC++深入详解(chapter 4)
Part 1 画图void CChapter4View::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call defaul原创 2011-09-18 10:22:33 · 592 阅读 · 0 评论 -
static浅谈
Example#include //无论采用什么样的操作,程序代码都是在内存中运行的,只有在内存中占有一席之地,//我们才能访问它,如果一个成员函数或成员变量还未在内存中产生,结果是无法访问的class point{public: void ou原创 2011-09-18 11:11:58 · 400 阅读 · 0 评论 -
this指针详述
this指针只能在一个类的成员函数中调用,它表示当前对象的地址。下面是一个例子: void Date::setMonth(int mn ) { month = mn; // 这三句是等价的 this->month = mn; (*this).month = m转载 2011-09-14 20:20:04 · 388 阅读 · 0 评论 -
typedef和#define的用法与区别
一、typedef的用法在C/C++语言中,typedef常用来定义一个标识符及关键字的别名,它是语言编译过程的一部分,但它并不实际分配内存空间,实例像:typedef int INT;typedef int ARRAY[10];转载 2011-09-13 10:11:50 · 363 阅读 · 0 评论 -
mallco和new的区别
malloc与free是C++/C语言的标准库函数,new/delete是C++的运算符。它们都可用于申请动态内存和释放内存。对于非内部数据类型的对象而言,光用maloc/free无法满足动态对象的要求。对象在创建的同时要自动执行构造函数,对象在消亡之前要自动执行析构函数。由转载 2011-09-13 10:01:04 · 1079 阅读 · 0 评论 -
C++模版
1. 模板的概念。我们已经学过重载(Overloading),对重载函数而言,C++的检查机制能通过函数参数的不同及所属类的不同。正确的调用重载函数。例如,为求两个数的最大值,我们定义MAX()函数需要对不同的数据类型分别定义不同重载(Overload)版本。//函数1.转载 2011-09-09 09:26:10 · 303 阅读 · 0 评论 -
Effective C++(Item3) Prefer new and delete to malloc and free
string* stringArray1 = static_cast(malloc(10*sizeof(string)));string* stringArray2 = new string[10];stringArray1 points to enough memory for 10 string objects,but no objects have been constructed原创 2011-11-05 00:35:45 · 952 阅读 · 1 评论
分享