好文備份

__attribute__((constructor(PRIORITY)))

__attribute__((destructor(PRIORITY)))

http://huenlil.pixnet.net/blog/post/26078382-%5B%E8%BD%89%5Dgnu-c-__attribute__-%E6%A9%9F%E5%88%B6%E7%B0%A1%E4%BB%8B

 __attribute__((visibility("default")))

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

Singleton

好文轉貼

原文

http://stackoverflow.com/questions/1008019/c-singleton-design-pattern

class S
{

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

http://stackoverflow.com/questions/201101/how-to-initialize-an-array-in-c

If your compiler is GCC you can use following syntax:

int array[1024]={[0...1023]=5};

//================================================================================================================

// description,   initialize a array 

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

copy from 

http://stackoverflow.com/questions/3553296/c-sizeof-single-struct-member

Although defining the buffer size with a #define is one idiomatic way to do it, another would be to use a macro like this:

#define member_size(type, member) sizeof(((type *)0)->member)
and use it like this:

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

http://godspeedlee.myweb.hinet.net/trick.html

 Hacker's Delight

http://www.hackersdelight.org/

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

http://twpug.net/docs/ccfaq/node77.html

http://good-ed.blogspot.tw/2011/02/char-foo8.html

http://stackoverflow.com/questions/201101/how-to-initialize-an-array-in-c

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

http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/rzab6/poll.htm

http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#blocking

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

//========== debug ==================

引用及備分自以下網址

http://www.jeffhung.net/blog/articles/jeffhung/1013/

在程式寫作的過程中,通常我們會需要輸出一些訊息,方便我們瞭解程式的運作情形,以便偵錯。因為這些訊息,對程式的真正使用者,也就是我們開發者的 客戶,並沒有意義。是故,通常我們會將程式分成測試版 (debug version 或 debug mode) 或釋出版 (release version 或 release mode),然後只在測試版裡輸出這些訊息,而在釋出版裡完全抑制這些訊息的輸出。

第零版:dprintf_v0.c

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

出處在下面的網址, 寫的太好 我備分而已

位結構

http://hi.baidu.com/dirac/blog/item/daf8980e62ba01e437d12245.html

C/C++中的struct位结构详解
2007年10月10日 星期三 下午 2:52

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

if ... else的簡寫如下


variable  = 

(condition) ? statment1 : statment2

condition 是條件式

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

class CTest{

    std::ostream debug_message;

    explicit CTest():debug_message( cout.rdbuf() ){} ;

   ~CTest(){};

   void Print(){

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


原文出處

http://blog.xuite.net/kamory0931/fightdreamer/52223417-%E7%B5%90%E6%A7%8B%E7%9A%84%E5%B0%8D%E9%BD%8A(Struct+Member+Alignment)

結構的對齊(Struct Member Alignment)

變數的宣告,會配置其所需的記憶體。每種變數所需的大小不一樣,比如說char是1 bytes,int 是4 bytes,double則是8 bytes。
如果是這樣,那這些大小在記憶體中是如何擺放呢?是直覺的一個接一個放嗎?

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

1 2 3
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。