2010/10/10

Microsoft C/C++ features support for sized integer types. You can declare 8-, 16-, 32-, or 64-bit integer variables by using the __intn type specifier, where n is 8, 16, 32, or 64.

The following example declares one variable for each of these types of sized integers:

The types __int8, __int16, and __int32 are synonyms for the ANSI types that have the same size, and are useful for writing portable code that behaves identically across multiple platforms. The __int8 data type is synonymous with type char, __int16 is synonymous with type short, and __int32 is synonymous with type int. The __int64 type has no ANSI equivalent.

The following sample shows that an __intxx parameter will be promoted to int:

 

Microsoft C/C++ 功能支持固定大小整数类型。 您可以使用 __intn 类型说明符声明 8 位、16 位、32 位或 64 位整数变量,其中 n 为 8、16、32 或 64。

以下示例为这些类型的固定大小整数声明了一个变量:

__int8__int16 和 __int32 类型是大小相同的 ANSI 类型的同义词,用于编写在多个平台中具有相同行为的可移植代码。 __int8 数据类型与char 类型是同义词,__int16 与 short 类型是同义词,而 __int32 与 int 类型是同义词。 __int64 类型没有 ANSI 等效项。


以下示例说明 __intxx 参数将提升为 int

 

2016/10/13

CArray Class

Supports arrays that are similar to C arrays, but can dynamically shrink and grow as necessary.

template < class TYPE, class ARG_TYPE = const TYPE& > 
class CArray : 
   public CObject

Parameters

TYPE

Template parameter specifying the type of objects stored in the array. TYPE is a parameter that is returned by CArray.

ARG_TYPE

Template parameter specifying the argument type used to access objects stored in the array. Often a reference to TYPE. ARG_TYPE is a parameter that is passed to CArray.

Remarks

Array indexes always start at position 0. You can decide whether to fix the upper bound or allow the array to expand when you add elements past the current bound. Memory is allocated contiguously to the upper bound, even if some elements are null.

【tip(Before using an array, use SetSize to establish its size and allocate memory for it. If you do not use SetSize, adding elements to your array causes it to be frequently reallocated and copied. Frequent reallocation and copying are inefficient and can fragment memory.)】

If you need a dump of individual elements in an array, you must set the depth of the CDumpContext object to 1 or greater.

Certain member functions of this class call global helper functions that must be customized for most uses of the CArray class. See the topic Collection Class Helpers in the MFC Macros and Globals section.

Array class derivation is similar to list derivation.

For more information on using CArray, see the article Collections.

支持类似于 C 数组、 但可以动态减小和增大的根据需要的数组。

指定数组中存储的对象类型的模板参数。 TYPE是一个参数,返回的CArray

指定用于访问存储在数组中的对象的参数类型的模板参数。 通常引用TYPE。 ARG_TYPE是一个参数,传递给CArray

备注

数组索引始终位置 0 处开始。 您可以决定是修复上限还是启用要展开时添加过去的当前绑定元素的数组。 内存是连续分配的上限,即使某些元素均为 null。

【提示

在使用一个数组之前, 使用SetSize建立其大小并为其分配内存。 如果不使用 SetSize,则向数组添加元素会导致它经常重新分配和复制。 经常重新分配和复制会降低效率而且会产生内存碎片。】

如果你需要在数组中的各个元素的转储,则必须设置的深度CDumpContext为 1 或更大的对象。

此类调用全局帮助器函数的某些成员函数必须进行自定义的大部分使用CArray类。 请参阅主题集合类帮助器MFC 宏和全局部分中。

数组类派生就像列表派生。

有关如何使用CArray,请参阅文章集合

parameter和argument的区别

1. parameter是指函数定义中参数,而argument指的是函数调用时的实际参数。

2. 简略描述为:parameter=形参(formal parameter), argument=实参(actual parameter)。

3. 在不很严格的情况下,现在二者可以混用,一般用argument,而parameter则比较少用。

While defining method, variables passed in the method are called parameters.
当定义方法时,传递到方法中的变量称为参数.
While using those methods, values passed to those variables are called arguments.
当调用方法时,传给变量的值称为引数.(有时argument被翻译为“引数“)