google的C++單元測試架構gtest

這個一個google主持的開源項目,http://code.google.com/p/googletest/ gtest在google的很多其他的開源項目中都使用到了,如:chromium gtest的優點,就是寫案例簡單,並且跨平台,有一定的可擴充性 用TEST這個宏加上我們的代碼就可以生產一個案例,例如: TEST(FactorialTest, Zero) { EXPECT_EQ(1, Factorial(0)); } 在這裡FactorialTest是案例名稱, Zero是測試名稱

C#: reference type and value type

1. Class is reference type while Struct is value type.2. Referece type data will be allocated on the heap always, while value type data will be either on the stack as local variable for example or on the heap.3. Referece type holds a reference to

C++/CLI Basic

1. Why need it?Mainly it works as the bridge between managed code and native c++ code, as it's the only graceful way to be able to talk to both sides.Using /cli compiler option, it can generate mixed code to benefit below

[Tip: C# in VS]Some quick tips for working on C# in VS

1. Place your cursor, by a single click, immediately after the closing curly brace of theMain method. This highlights the beginning and closing braces.2. Press Ctrl+Enter. This inserts a new line between the curly braces, moves the cursor tothat

C++/CLI VS CSharp

Kenny Kerr 一篇名為C++: The Most Powerful Language for .NET Framework Programming文章中的對比表:描述C++/CLIC#建立參考型別的對象ReferenceType^ h = gcnew ReferenceType;ReferenceType h = new ReferenceType();建立實值型別的對象ValueType v(3, 4);ValueType v = new ValueType(3,

c# Method Parameters

In C#, you have four types of method parameters: value, ref, out, and params.1. The default parameter type is value.2. If you want calling code to see changes to a value type variable, the parameter type should be ref. Ref parameters definitely must

The syntax for stack versus heap allocation of C++, C++/CLI and CSharp

 The syntax for stack versus heap allocation of C++, C++/CLI and CSharpNative C++ lets you choose where to create a given object.Any type can be allocated on the stack or the CRT heap.// allocated on the stackstd::wstring stackObject; // allocated

[Tip] Use C# snippet to be more productive

Snippet is so convenient to use in C#!I need to get the way / list of getting snippets in C# later on really!Now give a good example of using snippet to write switch:enum Months { Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec }Months

[Tip: property]C#3.0 auto-implemented property

The pattern of properties encapsulating a single field is so common that C# 3.0 introduced auto-implemented properties. Here’s an example:public int Rating { get; set; }This Rating property encapsulates some value of type int. Because calling code

C# Using Statement + Using Keyword

Using StatementThe using statement obtains one or more resources, executes a statement, and then disposes of the resource. A using statement is translated into three parts:acquisition, usage, and disposal.Example:using (Font font1 = new Font("Arial",

C# String

In C#, content regards with string includes:1. String typeIts features:  a. built-in reference type.  b. immutable (meaning that a string can’t be modified once created) and sealed (meaning that it can’t be derived from).  c. string equality

Mixing unmanaged C++ and CSharp

因為新項目將主要用到CSharp,並同時會涉及Mix programming的問題,與Native C++ and C++ CLI (common language infrastructure),今天迅速的google下,做些初步瞭解先。現在的理解:1. 這裡說的mix programming的意思應該是:讓CSharp的module,Native C++ module和C++ CLI的module之間可以互相調用。當然不是把這不同語言的code直接寫在一起嘍。。2.

C# History and Future

To know the future of C#, look at The Future of C#To know the future of programming, look at Microsoft Perspectives on the Future of Programming有一點小小的認識:從C#的版本發展來看,每個版本都增加了新特性。增加的新特性大體上是為了:C#1.0, 2.0:集中精力汲取Java,c++這些流行靜態語言的精髓,打造最佳模仿吧;C# 3.0:引入了很多文法糖-

[Tool] Memory leak & performance profiling tools for C# / C++

For C++:Memory analysis tools: 1. C++ memory leak detector - Memory Validator (http://www.softwareverify.com/index.html)2. Other as references: Purify from IBMPerformance profiling tools: For C#: Memory analysis tools: As developers, we are often

如何快速定位一個函數的返回點(c/c++ Only)

摘自: 如何快速定位一個函數的返回點如何快速定位一個函數的返回點,這對於一個比較短小精悍的函數來講,從來就不是問題,但是假設我們有一個名為LongFunction的1000行長的函數, 調用如下: 1bool bSuccess =

Two Valuable Features in C#4.0

文章目錄 C# has used duck typing for a long time 1. Duck Typing ("If it walks like a duck and quacks like a duck, it must be a duck.") [Refer to here]Duck typing allows an object to be passed in to a method that expects a

Some Noteable Diffs Between C++ and C#

1. Can I use typedefs in C#?No, C# has no direct equivalent of the C++ typedef. C# does allow an alias to be specified via the using keyword: using IntList = System.Collections.Generic.List<int>;but the alias only applies in the file in which

Mixed mode programming is the absolute power of C++/CLI

From this article in codeproject. Mixed mode programming is the absolute power of C++/CLI, and so is C++/CLI the superior and mightiest of all programming languages. C++/CLI is to C++, as it is to C. You can do C programming in C++. In the same

[Tip C# collection]List or EmployeeList?

List<Employee> or EmployeeList?In current versions of C#, to get a strongly-typed collection, you need to define a separate type for that collection. So if you want to expose a collection of employees, you created an EmployeeCollection

Sample: Mixing Unmanaged C++, C++/CLI, and C# code

From: Sample: Mixing Unmanaged C++, C++/CLI, and C# codeWe have this simple unmanaged C++ class UnmanagedFoo:E:\sample\vc\mixed>more ufoo.h#include <stdio.h>class UnmanagedFoo{public:    UnmanagedFoo() {printf("Constructing

總頁數: 4314 1 .... 900 901 902 903 904 .... 4314 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.