Microsoft Specific

原创 2006年06月15日 00:50:00

The extended attribute syntax for specifying storage-class information uses the __declspec keyword, which specifies that an instance of a given type is to be stored with a Microsoft-specific storage-class attribute listed below. Examples of other storage-class modifiers include the static and extern keywords. However, these keywords are part of the ANSI specification of the C and C++ languages, and as such are not covered by extended attribute syntax. The extended attribute syntax simplifies and standardizes Microsoft-specific extensions to the C and C++ languages.

This is the extended attribute grammar for C++:


decl-specifier :
__declspec ( extended-decl-modifier-seq )
extended-decl-modifier-seq :
extended-decl-modifier extended-decl-modifier-seq
extended-decl-modifier :
property({get=get_func_name|, put=put_func_name})

White space separates the declaration modifier sequence. Examples appear in later sections.

Extended attribute grammar supports these Microsoft-specific storage-class attributes: align, allocate, deprecated, dllexport, dllimport, naked, noinline, noreturn, nothrow, novtable, selectany, and thread. It also supports these COM-object attributes: property and uuid.

The thread, naked, dllimport, dllexport, nothrow, property, selectany, and uuid storage-class attributes are properties only of the declaration of the object or function to which they are applied. The thread attribute affects data and objects only. The naked attribute affects functions only. The dllimport and dllexport attributes affect functions, data, and objects. The property, selectany, and uuid attributes affect COM objects.

The __declspec keywords should be placed at the beginning of a simple declaration. The compiler ignores, without warning, any __declspec keywords placed after * or & and in front of the variable identifier in a declaration.

A __declspec attribute specified in the beginning of a user-defined type declaration applies to the variable of that type. For example:

(dllimport) class X {} varX;

In this case, the attribute applies to varX. A __declspec attribute placed after the class or struct keyword applies to the user-defined type. For example:

class (dllimport) X {};

In this case, the attribute applies to X.

The general guideline for using the __declspec attribute for simple declarations is as follows:

decl-specifier-seq init-declarator-list;

The decl-specifier-seq should contain, among other things, a base type (e.g. int, float, a typedef, or a class name), a storage class (e.g. static, extern), or the __declspec extension. The init-declarator-list should contain, among other things, the pointer part of declarations. For example:

(selectany) int * pi1 = 0;   //OK, selectany & int both part of decl-specifier
int (selectany) * pi2 = 0;   //OK, selectany & int both part of decl-specifier
int * (selectany) pi3 = 0;   //ERROR, selectany is not part of a declarator

The following code declares an integer thread local variable and initializes it with a value:

// Example of the  keyword
( thread ) int tls_i = 1;

END Microsoft Specific


MPAndroidChart 教程:图表的具体设置 Specific chart settings(六)

本章将重点介绍各个图表类型特定的设置。线状图,柱状图,散点图,烛状图 & 气泡图 : setAutoScaleMinMaxEnabled(boolean enabled) : 标志,指示自动缩放在y轴...


大多数函数都不是可重入的。这也就是说在某一个线程已经调用了一个函数时,如果你再调用同一个函数,那么这样是不安全的。一个不可重入的函数通过连续的调用来保存静态变量或者是返回一个指向静态数据的指针。 举例...

Thread-Specific Storage

This article told the last pattern illustrated in POSA2 - Thread Specific Storage, which is such a c...
  • qwidget
  • qwidget
  • 2011年07月30日 13:51
  • 846

Using AutoHotKey to open a specific OneNote page

Using AutoHotKey to open a specific OneNote page John Guin John Guin Microsoft ...

Githubz中特殊的命令Git-Specific Commands

刚开始接触Github,开始学习怎么用。整理一些Git的命令: Since Git was designed with a big project like Linux in mind, there...

Allow regions of specific table to be load-balanced

Description:From our experience, cluster can be well balanced and yet, one table's regions may be ba...
  • macyang
  • macyang
  • 2011年02月15日 18:18
  • 1163

General Non-Device Specific Boot Args

These are the boot arguments that are not related to any specific device or peripheral. They are ins...

RFC3265 翻译 Session Initiation Protocol (SIP)-Specific Event Notification SIP-特定事件通

闲来无事,找篇文章翻译一下,复习下英文,也强迫自己好好读读协议文档。 从短的开始吧,呵呵,也希望自己能够坚持下去。 1 简介 在终端节点间通信过程中,发送异步通知消息的能力被证实在很多类型的SI...

多线程设计模式——Thread Specific Storage(线程特有存储)模式

Thread Specific Storage(线程特有存储)模式
  • buyoufa
  • buyoufa
  • 2016年07月11日 13:07
  • 489

c# Runtime load library; Load Assembly from Specific Directory Path

Reference: using System; using System.Collections.Generi...
  • zx917
  • zx917
  • 2012年10月18日 13:06
  • 410
您举报文章:Microsoft Specific