使用VC多年了,今天发现VC一个完全没接触过的语法,汗颜.哪位高手能帮忙解释一下

使用VC多年了,今天发现VC一个完全没接触过的语法,汗颜...!谁能帮忙解释一下
今天在MSDN上搜索关键字"__uuidof"的功能(这个东西也不懂,但这不是重点)
MSDN列出了一个例子:

C/C++ code

// expre_uuidof.cpp
// compile with: ole32.lib
#include "stdio.h"
#include "windows.h"

[emitidl];
[module(name="MyLib")];
[export]
struct stuff {
   int i;
};

int main() {
   LPOLESTR lpolestr;
   StringFromCLSID(__uuidof(MyLib), &lpolestr);
   wprintf_s(L"%s", lpolestr);
   CoTaskMemFree(lpolestr);
}




其中这几行:
[emitidl];
[module(name="MyLib")];
[export]
开始还以为这是注解什么的,但是我原封不动复制到VC里竟然能运行.
真是不知道是什么语法,甚至不知道着是语法还是宏还是别的什么.还有它的作用是什么呢?
谁能给我解释一下么.先谢谢了.

我擅自增加了一行:
[kkksss]
结果编译器提示:
error C2337: “kkkss”: 未找到属性

这个我都不知道去哪里找资料,因为不知道在网上搜索什么关键字


------解决方案--------------------
首次见,扩展阅读了下

Determines whether all subsequent IDL attributes will be processed and placed in the generated .idl file.


[ emitidl([boolean],
defaultimports=[boolean]
) ] ;
 

Defines the library block in the .idl file.


[ module (
type=dll,
name=string,
version=1.0,
uuid=uuid,
lcid=integer,
control=boolean,
helpstring=string,
helpstringdll=string,
helpfile=string,
helpcontext=integer,
helpstringcontext=integer,
hidden=boolean,
restricted=boolean,
custom=string,
resource_name=string,
) ];
 

------解决方案--------------------
这个好像用在COM中比较多
------解决方案--------------------
这是atl 7.0 以后添加的,称为属性编程。
英文关键字为Attributed Programming,如有兴趣,可搜索msdn。

属性编程看起来编码似乎更简单,但是受限太多,缺少足够的灵活性,而且出错难以找到原因,实际上应用并不多。楼主大致了解一下即可,不用花费太多时间。
------解决方案--------------------
COM中的属性,看看这吧:
After the emitidl C++ attribute is encountered in a source code file, IDL category attributes will be placed in the generated .idl file. If there is no emitidl attribute, IDL attributes in the source code file will be output to the generated .idl file.

It is possible to have multiple emitidl attributes in a source code file. If [emitidl(false)]; is encountered in a file without a subsequent [emitidl(true)];, then no attributes will be processed into the generated .idl file.

Each time the compiler encounters a new file, emitidl is implicitly set to true.
------解决方案--------------------
限制太多,VC2008已经不再推荐属性编程了,还是老老实实地放到IDL里去。