Microsoft Specific

转载 2006年06月14日 14:09:00

Microsoft Specific

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++:

Grammar

decl-specifier :
__declspec ( extended-decl-modifier-seq )
extended-decl-modifier-seq :
extended-decl-modifieropt
extended-decl-modifier extended-decl-modifier-seq
extended-decl-modifier :
align(#)
allocate("segname")
deprecated
dllimport
dllexport
naked
noinline
noreturn
nothrow
novtable
property({get=get_func_name|, put=put_func_name})
selectany
thread
uuid("ComObjectGUID")

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:

__declspec(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 __declspec(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:

__declspec(selectany) int * pi1 = 0;   //OK, selectany & int both part of decl-specifier
int __declspec(selectany) * pi2 = 0;   //OK, selectany & int both part of decl-specifier
int * __declspec(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 __declspec keyword
__declspec( thread ) int tls_i = 1;

END Microsoft Specific

走近“领域特定语言”(Domain-Specific Languages)

领域特定语言(Domain-Specific Languages,简称DSL),是一个很有用的术语和概念,但其边界很模糊。一些东西很明显是DSL,但另一些可能会引发争议。本文接下来就走近“领域特定语言...
  • hzbooks
  • hzbooks
  • 2013年03月26日 14:50
  • 5716

Microsoft Web Browser控件的常用功能

http://www.moon-soft.com/doc/33963.htm   微软的Web Browse控件 使用方法,选择菜单 Project -> Add to Project -> Co...
  • codespad
  • codespad
  • 2013年03月04日 11:09
  • 1064

【Windows】加密服务

加密服务 您可以使用加密来确保应用程序层数据的安全。加密服务提供程序 (CSP)是系统程序接口中显示的加密标准、算法和函数的实施。 Jonathan Wiggs  在 MSDN 杂志中发表了一篇...
  • chenlu5201314
  • chenlu5201314
  • 2016年12月01日 10:36
  • 507

Mirai源码分析报告

物联网僵尸网络病毒“Mirai”在上月参与发起了针对KrebOnSecurity安全站点的大规模分布式DDoS攻击,新一类僵尸网络从各种容易被感染的物联网设备中发起,流量巨大防不胜防。“Mirai”可...
  • u011596455
  • u011596455
  • 2017年04月24日 12:23
  • 1022

样式资源(style)和主题的使用

下面通过一个实例来演示,定义一个style.xml,然后在布局文件、和Manifest中引用此样式: activity: package com.lovo; import android.a...
  • u010142437
  • u010142437
  • 2013年06月06日 15:50
  • 3546

WIN7中组件服务中的DCOM配置找不到Microsoft Excel应用程序的解决办法和

转自:http://blog.csdn.net/lploveme/article/details/8215265 在运行栏中输入命令:dcomcnfg,打开组件服务管理窗口,但是却发...
  • goodjie_12
  • goodjie_12
  • 2015年07月23日 14:03
  • 1951

Scala课堂-5-类型和多态类型

什么是静态类型?它们为什么有用?按 Pierce 的话讲:“类型系统是一个语法方法,它们根据程序计算的值的种类对程序短语进行分类,通过分类结果错误行为进行自动检查。” 类型允许你表示函数的定义域和值域...
  • chunlongyu
  • chunlongyu
  • 2016年11月12日 14:37
  • 526

微软符号服务器下载符号总结

 微软符号服务器地址http://msdl.microsoft.com/download/symbols, 但是你手动在浏览器里面输入是访问不到的,他只提供给调试程序进行下载 1、方法1:  ...
  • xiliang_pan
  • xiliang_pan
  • 2015年12月16日 13:28
  • 1512

App Store 审核指南最新中英文参照版

1.1 As a developer of Apps for the App Store you are bound by the terms of theProgram License Agreem...
  • u010223072
  • u010223072
  • 2016年05月28日 14:44
  • 5907

Microsoft Speech Platform 自学笔记2 环境要求与安装过程

转载自:http://blog.sina.com.cn/s/blog_5de73d0b01017g9x.html
  • xiong_mao_1
  • xiong_mao_1
  • 2014年09月18日 01:05
  • 1053
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Microsoft Specific
举报原因:
原因补充:

(最多只允许输入30个字)