Abstract一個很簡單的題目,來看看C和C++要如何實現。IntroductionC語言1 /* 2 (C) OOMusou 2008 http://oomusou.cnblogs.com3 4 Filename : array_minus_1.c5 Compiler : Visual C++ 8.06 Description : Demo how to minus 1 in each element of array7 Release : 03/26/2008 1.08
Abstract由於嵌入式的CPU運算速度較差,一些演算法在軟體可能無法達到real time需求,這時會考慮用Verilog或VHDL來實現硬體加速。為了減少time to market,Altera提供了C2H compiler,讓你直接將用軟體C語言的程式碼變成硬體。Introduction使用環境:Quartus II 7.2 SP1 + MegaCore IP 7.2 SP1 + DE2(Cyclone II EP2C35F627C6)什麼是C2H?它是(C to
http://www.cppreference.com/operator_precedence.html PrecedenceOperatorDescriptionExampleAssociativity1()[]->.::++--Grouping operatorArray accessMember access from a pointerMember access from an objectScoping
C++ 11標準新增加了Lambda運算式,以後小函數可以直接內嵌Lambda運算式搞定了。例如排序,我們以前要這麼寫:#include <iostream>#include <cstdlib>#include <algorithm>bool compare( const int & a, const int & b ){ return a < b;}using namespace std;int main ( ){
Abstract本文例舉了我們在註解程式碼時的13個小技巧,這讓我們的代碼更易讀懂,更易維護。Introduction原文出處:http://www.devtopics.com/13-tips-to-comment-your-code/簡中翻譯:http://www.cnblogs.com/nicholasun/archive/2008/04/26/1171557.html本文採用簡中翻譯為藍本,潤飾成繁中翻譯。1.Comment each level對每一層級採用統一的方式注釋每個程式碼區塊,
Abstract二維陣列和字串陣列是個很類似的東西,The C Programming Language還特別提出一小節來探討,我們來看看兩者的差異在哪裡?Introduction在The C Programming Language 2nd 5.9節 p.113標題為Pointers vs. Multi-dimensional Arrays,特別討論二維陣列與字串陣列的差別,不過他並沒有提出實際的範例來解釋,我試著用了一個簡單的範例來探討。C語言1 /* 2 (C) OOMusou 2008
Abstract同學問我的小問題,還蠻有趣的,就順便寫寫看。Introduction使用環境:Visual C++ 9.0 / Visual Studio 2008get_c_class_ip_host_id.c / CCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1 /* 2 (C) OOMusou 2008
AbstractVerilog由於在語法上向C靠攏,若熟悉C語言,學Verilog倍感親切,但也由於語法類似,若把Verilog當成C語言來思考,怎很難抓到硬體的精神。IntroductionVerilog有3點思維與C語言不一樣1.軟體是循序的,而硬體是並行的C語言是一行一行的執行,就算組合語言也是一樣,或許你會說threading,但在微觀下仍是循序地執行。但硬體電路就不一樣,電路只要一插上電,所有電路就同時工作。如以下的Verilog1 always@(posedge clk) begin
Abstract一個很常見的需求:『將struct塞進vector』,在C++該怎麼做呢?Introduction使用環境:Visual C++ 9.0 / Visual Studio 2008由於vector只允許一個欄位,所以才會想將struct塞進vector,以彌補vector的不足。struct_in_vector.cpp / C++Code highlighting produced by Actipro CodeHighlighter