c++/c chips

來源:互聯網
上載者:User
scope resolution region operator:" ::"http://msdn.microsoft.com/en-us/library/b451xz31.aspxhttp://msdn.microsoft.com/en-us/library/56e442dc(v=VS.71).aspx

Format Specification Fields: printf and wprintf Functions

 

想要printf unsigned long long 用%llx; e.g.:printf("id is %llx /n", xxid);

 

 

unicode/mbcs/ansi

程式裡還是用tchar比較好,否則轉換起來還是挺麻煩的。

其實主要是unicode和非unicode之間的轉換,mbcs是單位為char,程式解析的時候有可能一次解析變長個char來組成中文一類的字元。

http://msdn.microsoft.com/en-us/library/c426s321(VS.71).aspx

 

 

 

static_cast

http://msdn.microsoft.com/en-us/library/c36yw7x9(v=vs.80).aspx

compile time的類型轉換,一種是像int轉float這種,沒什麼好說的。

pointer轉換到是值得注意。

比如:

 

class B:public A, public AA<br />{<br />//...<br />};

 

在做B* b = new B; AA* a = static_cast<AA*>(b);這樣的操作的時候,a的地址會是根據記憶體的一個位移而不是和b一樣,或者dynamic_cast類型的NULL;

http://msdn.microsoft.com/en-us/library/5tkz6s71.aspx

__declspec( selectany ) declarator
用這個可以直接header裡面define global/static variable, 然後在link的時候只選擇一個,就不會出現multiple definition了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.