C++中的_In_是什么
What is _In_ in C++?
我已经搜索了很多,但没有找到有用的结果。
我目前正在尝试为Windows 8 Metro编写一个简单的DirextX游戏,并且遇到了很多_In_
。我只是想知道它是什么。
此外,我看到了很多使用^
作为指针*
的情况,我觉得这很奇怪。除此之外,有些类有一个ref class MyClass
接口,我认为这是为了C#的易读性。
不管怎样,任何帮助都是非常棒的。
它是一个SAL注释,用于代码分析。注释本身被定义为宏,在正常构建中,这些宏可以扩展为零。
^
和ref class
是C++/CX的功能,这是一组语言扩展,旨在使在C++中为Windows 8构建Metro风格的应用程序变得更容易。两者都不是标准C++的一部分。该文档(以前链接过)具有指向教程的链接和描述语言扩展的参考资料。
我认为(从快速谷歌中)_in_
是用来指示参数是函数/方法的输入还是输出(_out_
)的。
^
是一个托管指针(垃圾回收指针,与C++/CLI相关)。
在sal.h文件中,o找到了此定义
// Input parameters --------------------------
// _In_ - Annotations for parameters where data is passed into the function, but not modified.
// _In_ by itself can be used with non-pointer types (although it is redundant).
// e.g. void SetPoint( _In_ const POINT* pPT );
#define _In_ _SAL2_Source_(_In_, (), _Pre1_impl_(__notnull_impl_notref) _Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))
#define _In_opt_ _SAL2_Source_(_In_opt_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre_valid_impl_ _Deref_pre_readonly_)
_Out_
表示作为引用传递的参数。CCD_ 11的意思正好相反。CCD_ 12和CCD_。
相关文章:
- "Warning : No return statement in function returning non-void"是什么意思?
- "in"和"out"在参数方向上是什么意思?
- 警告的原因是什么:"when type is in parentheses, array cannot have dynamic size"?
- 'default-initialization in copy-initialization context'在C++中是什么意思?
- Python的"in"运算符的C++等价物是什么?
- "C4649: attributes are ignored in this context"的含义是什么?
- 是什么导致了代码中出现"error LNK2005: already defined in .obj"错误?
- 这个编译器错误是什么意思 - "qualified-id in declaration before ‘=’ token" C++?
- SDL:"working natively in C++"是什么意思?
- C++ 中的" Variable ' i ' was not declared in scope "是什么?
- "pointer was not declared in this scope"是什么意思
- "error: not declared in this scope?"是什么意思
- 计算"copying a binary file in c++ on linux"消耗时间的最佳方法是什么?
- "inline function need to be DEFINED in all tranlation units"背后的理由是什么?
- "universal-character-name encountered in source"警告的目的是什么?
- 当 std::stringstream 由 ( "some content" , std::ios::in|std::ios::ate) 构造时,tellg() 的预期行为是什么?
- "Objects are basic run-time entities in an object-oriented system"是什么意思?
- "duplicate symbol _heating_unit in BangBangControlTest.o and BangBangControl.o"是什么意思?
- & in (a & 1) 的目的是什么
- in(std::cin):它是什么意思