assert functions in C/C++/C#
2012-08-03 14:21
330 查看
I just had several small tests. Here is a summary to the assertion related APIs we are using in our product.
Assert Function Comments
assert Just work in debug mode; standard C assert function
ASSERT Just work in debug mode; MFC assert function
System::Diagnostics::Debug::Assert Works both in debug mode and Release mode; Managed C++ assert function
System.Diagnostics.Debug.Assert Just work in debug mode; C# assert function
Please note above red line, ‘System::Diagnostics::Debug::Assert’ works both in debug and release mode, so if we have following code in managed C++:
System::Diagnostics::Debug::Assert(false, "something wrong");
We would always see the assertion window both in debug and release build. So, in managed C++, we’d better use following code to avoid assertion in Prod-build:
#ifdef DEBUG
System::Diagnostics::Debug::Assert(false, "something wrong");
#endif
转自:http://blog.csdn.net/allenwwg/article/details/6336401
Assert Function Comments
assert Just work in debug mode; standard C assert function
ASSERT Just work in debug mode; MFC assert function
System::Diagnostics::Debug::Assert Works both in debug mode and Release mode; Managed C++ assert function
System.Diagnostics.Debug.Assert Just work in debug mode; C# assert function
Please note above red line, ‘System::Diagnostics::Debug::Assert’ works both in debug and release mode, so if we have following code in managed C++:
System::Diagnostics::Debug::Assert(false, "something wrong");
We would always see the assertion window both in debug and release build. So, in managed C++, we’d better use following code to avoid assertion in Prod-build:
#ifdef DEBUG
System::Diagnostics::Debug::Assert(false, "something wrong");
#endif
转自:http://blog.csdn.net/allenwwg/article/details/6336401
相关文章推荐
- assert functions in C/C++/C#
- Some interesting facts about static member functions in C++
- Implementing Callback Functions Using Delegates In C++
- usage of fscanf and other read functions in C/C++
- Inline Functions in C++
- Return array from functions in C++
- How to call c++ exported method and classes in c#
- Create a C++ DLL and Use It in C# (P/Invoke)
- Writing Efficient String Functions in C#
- 引用、指针、抽象类的多态 in C++ and C#
- How do virtual functions work in C++?
- Inline Functions in C++
- Left, Right and Mid functions in C#
- Output Info Functions in C#
- c#调用c++ dll. unable to find an entry point named function in dll
- Debug C++ dll in C# project
- 如何将C++中的SOCKADDR_IN*参数类型转换成C#中的参数类型
- Static member functions in C++
- Think before you code, Virtual Functions in C++
- C++ 结构体 sockaddr_in 转换为C#