zoukankan      html  css  js  c++  java
  • From MSDN: Pointers in the Common Type System


    Pointers are special kinds of variables. There are three kinds of pointers supported by the runtime: managed pointers, unmanaged pointers, and unmanaged function pointers.

    A managed pointer, also known as a handle to an object on the managed heap, is a new type of pointer available to managed applications. Managed pointers are references to a managed block of memory from the common language runtime heap. Automatic garbage collection is performed on this heap. Managed pointers are generated for method arguments that are passed by reference. Some languages provide other ways of generating managed pointers. Only managed pointers are CLS-compliant.

    Note:

    In Visual C++ 2002 and Visual C++ 2003, __gc * was used to declare a managed pointer. This is replaced with a ^ in Visual C++ 2005, for example ArrayList^ al = gcnew ArrayList();.

    An unmanaged pointer is the traditional C++ pointer to an unmanaged block of memory from the standard C++ heap. Because unmanaged pointers are not part of the Common Language Specification (CLS), your language might not provide syntax to define or access these types. See the documentation for your language for information on support for unmanaged pointers.

    An unmanaged function pointer is also a traditional C++ pointer that refers to the address of a function. The CLS provides delegates as a managed alternative to unmanaged function pointers.

    An explicit definition of a pointer type is not required. All the information necessary to determine the type of a pointer is present when the pointer is declared.

    While pointer types are reference types, the value of a pointer type is not an object and you cannot determine the exact type from such a value.

    The common type system provides two type-safe operations on pointer types: loading a value from and writing a value to the location referenced by the pointer. These type-safe operations are CLS-compliant.

    The common type system also provides three byte-based address arithmetic operations on pointer types: adding integers to and subtracting integers from pointers, and subtracting one pointer from another. The results of the first two arithmetic operations return a value of the same type as the original pointer. These byte-based operations are not CLS-compliant.

  • 相关阅读:
    DataWindow修改的单元格文字颜色改变
    DataWindow奇偶行颜色显示不同
    Retrieve时不清除DataWindow原有数据
    Camera拍照声设定
    使用Log.isLoggable方法
    Android Audio遇到播放无声时的分析
    耳机jack构造及在应用时可能出现的问题
    【Android】使用persist属性来调用脚本文件
    [Android][Audio] audio_policy.conf文件分析
    Android4.4 耳机检测分析
  • 原文地址:https://www.cnblogs.com/silva/p/1076100.html
Copyright © 2011-2022 走看看