首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

volatile会修饰数组么

2012-08-31 
volatile能修饰数组么如我定义一个数组DWORD tex[10]我想告诉编译器,其中的每个元素都是易变的,如何 用vo

volatile能修饰数组么
如我定义一个数组DWORD tex[10];我想告诉编译器,其中的每个元素都是易变的,如何 用volatile来修饰?
volatile DWORD tex[10]和DWORD volatile tex[10]都是错的,貌似这样修饰的是数组名...求大神解释。
不胜感激..

[解决办法]
CV-qualifiers 修饰的是数组的元素 而不是数组本身。
c99标准如下:
If the specification of an array type includes any type qualifiers, the element type is soqualified,
not the array type.

c++标准如下:
A compound type (3.9.2) is not cv-qualified by the cv-qualifiers (if any) of the types from which it is compounded.Any cv-qualifiers applied to an array type affect the array element type, not the array type

热点排行