Compiler 在編譯程式時常常會對代碼進行優化的動作 , 

所謂優化的動作指的就是....舉個例子:

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在c中 , sizeof() function可以回傳該變數的位元組數目

for example:

JerryCheng 發表在 痞客邦 留言(0) 人氣()

ref : http://en.wikipedia.org/wiki/Degenerate_distribution

ref : http://www.sccs.swarthmore.edu/users/08/ajb/tmve/wiki100k/docs/Degenerate_distribution.html

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在Java中 , 要分割String通常我們會用String Class中的split method , 

不過其實還有另外一個class可以幫我們達到這樣的目的 , 那就是StringTokenizer Class.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Ctrl + W  : 關閉目前視窗

Ctrl + Tab  : 切換browser的視窗

JerryCheng 發表在 痞客邦 留言(0) 人氣()

一般來說 , 宣告在private區域就是代表部給class以外的人使用 , 

所以若把constructor宣告在private區域 , 代表就是不可以對這個class instantize.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

In C++, an iterator is any object that, pointing to some element in a range of elements (such as an array or a container),

 has the ability to iterate through the elements of that range using a set of operators

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Reference

[1]無插件Vim編譯技巧

JerryCheng 發表在 痞客邦 留言(0) 人氣()

The reference count tracks how many references to the object are currently active. 
When the number of references drops to zero, the object deletes itself. 
The last part is worth repeating: The object deletes itself; the program never explicitly deletes the object.
 

Here are the rules for reference counting:

 0. When the object is first created, its reference count is 1. At this point, the program has a single pointer to the object.
   1. Attach a counter to each pair in memory.
   2. When a new pointer is connected to that pair, increment the counter.
   3. When a pointer is removed, decrement the counter.
   4. Any cell with 0 counter is garbage. 
 

 ref : http://msdn.microsoft.com/en-us/library/ff485846(v=vs.85).aspx

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在Java中,  若我們想要設定小數的輸出位數 , 

可以藉由NumberFormat來完成這樣的需求 , 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

In their implementation in the C++ Standard Template Library, map containers take four template parameters:

template < class Key, class T, class Compare = less<Key>,class Allocator = allocator<pair<const Key,T> > > class map;

JerryCheng 發表在 痞客邦 留言(0) 人氣()

consider the following function:

int foo();

JerryCheng 發表在 痞客邦 留言(0) 人氣()

In addition to container classes and iterators, 

STL also provides a number of generic algorithms for working with the elements of the container classes. 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

There are four procedure when we want to use ctags.

1. go to the directory in which we want to trace the code.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

因為istringstream是繼承自ifstream , 

所以我們可以利用ifstream的一些特性 , 輕鬆的在讀取data時 , 轉換到我們所需的type.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

我們在讀檔時 , 因為不知道檔案的大小 , 通常需要一個方法來幫我們判斷是否已經讀到檔案結尾.

but ... You should never use feof() as the exit indicator for a loop. 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在C++中  , 若有兩個derived class 繼承同一個abstract base class時 , 

我們若以base class pointer (or reference )來接derived class的instance , 並使用base class的pointer

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Pure Virtual function , 

Pure Virtual function代表base class並無implement這個function的內容 , 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

有時我們會想判斷一個string是否包含一些特定的名詞 , 

通常要達到這樣的目的 , 最直覺的 , 我們可以用Pattern and Matcher , 

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Multiple inheritance enables a derived class to inherit members from more than one parent.

While multiple inheritance seems like a simple extension of single inheritance , 

JerryCheng 發表在 痞客邦 留言(0) 人氣()