Quark的小宇宙
===========================================================
Learn C++
===========================================================

2005-1-15

1.         In C++ pointer can be used as dynamic allocation of storage

2.         unsigned char take up 8 bits storage equal to one byte

3.         Void pointer (void *) can points to any type of variables, this is very useful when the type is not known until runtime.

2005-1-16

1.         Compiling error is always syntax problem but run error is logical problem

2005-1-18

1A default argument is a value given in the declaration.

2. Placeholder argument sometimes is useful in designing function.

3. Include guard is use in .h files for preventing multiple inclusion.

4. When designing a class the primary concern should be the interface make sense to those who use it and who read the resulting code.

2005-1-25

1.  The compiler will initialize a static array to zero.

2005-1-28

1.  Create a object with the function NEW, then puts it’s pointer to a container.(template is a container.)

2.  What “inline” mean? Why it must make sure no array-bounds violations occur when the function is inline?

3.  Why putting statements that allocate storage in header file may result in (conduce) multiple definition error at link time?

2005-1-31

1. It would generate more efficient code by eliminating storage and memory reads.

2005-2-1

1.    32bits Virtual Allocation method in windows system.

2005-2-2

1.  It’s important to use const when returning an object by value if you want to prevent its use as a left value.

2.  Built-in type means “int,char,float” etc.

3.  “compile time” VS “run time”

2005-2-3

1.         How to seed random number generator? (srand(time(0)), it must include <ctime> and <cstdlib>.

2.         It’s better to use c+ explicit cast away syntax: (const_cast<classname*>(this)),but mutable is better.

3.         It’s critical to use const with function arguments.

4.         In c, one of the ways to preserve efficiency is through the use of macros. But in c++ it use inline function to get efficiency.

2005-2-4

1.         You must take care of and think a lot of to design a function which will be called many times.

2.         A good programming language is which have least chance to make bugs for programmer.

2005-2-5

1.         Later, I must learn namespace, what it’s about?

2.         Constructor and destructor function is some different when considering use inline function. So you must consider more about efficiency.

3.         #define DEBUG(x) cout << #x " = " << x << endl, learn use “# ”

4.         Fist makes it work, and then optimize it.

5.         Whenever you design functions containing static variables you should keep multithreading issues in mind.

6.         Register specification is an optimization aid.


SmoothMan 发表于:2005.05.26 22:20 ::分类: ( 初始分类 ) ::阅读:(3601次) :: 评论 (0)

发表评论
标题

在此添加评论
表情符号: smile laughing tongue angry crying sad wassat wink

称呼

邮箱地址(可选)

个人主页(可选)




切换风格
新闻聚合
博客日历
文章归档...
最新发表...
博客统计...
网站链接...