What happend: Exception throws in the .ctor()?
2008-06-03 16:12
239 查看
1. If an exception was thrown in a type's .ctor(), then the class's destrutor wouldn't be called.
2. If a exception was catched in a try-catch block, all the well-constructed object will be destructed( destrutor method will be called) before enter the catch section:
try
{
CFoo a;
CFoo b;
throw int();
CFoo c;
}
catch(int& i)
{
//----
}
the destrutor of a, b will be called except c.
3. Any created heap objects will be well-deleted before existing the try block even though an exception occurs.
2. If a exception was catched in a try-catch block, all the well-constructed object will be destructed( destrutor method will be called) before enter the catch section:
try
{
CFoo a;
CFoo b;
throw int();
CFoo c;
}
catch(int& i)
{
//----
}
the destrutor of a, b will be called except c.
3. Any created heap objects will be well-deleted before existing the try block even though an exception occurs.
相关文章推荐
- What happend: Exception throws in the .ctor()?
- c++ what happens when a constructor throws an exception and leaves the object in an inconsistent state?
- In p = new Fred(), does the Fred memory “leak” if the Fred constructor throws an exception?
- July Challenge 2017 | Whats in the Name
- Describe the process of opening a file in Linux system, what actions the operating system w
- In C++, what’s the difference between an inline function and a macro?
- Difference between throw and throws in Exception handling - Java Example
- 解决System.Runtime.CompilerServices.ExtensionAttribute..ctor 与 ‘ExtensionAttribute’ is ambiguous in the namespace ‘System.Runtime.CompilerServices’ 问题
- 1.1 What is the plug-in?
- What have done in the last 2 days? (2010-10-05)
- what is the purpose of using translatable in Android strings?
- com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method findUserByUserNo in the service wusc.edu.facade.user.service.PmsUserFacade.
- What is the difference between a function expression vs declaration in JavaScript?
- What is the best comment in source code you have ever encountered? [closed]
- java.lang.IllegalArgumentException: The class class ** is not found in EntityFactory.
- java.lang.IllegalArgumentException: Invalid character found in the request target. The valid charac
- What will the following polymorphic code output in C ++
- 托福写作5-what is the most important characteristic that a person can have to be successful in life
- 【Java】Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1099
- What the hell is cmp byte ptr[rax],0 in a managed mini dump?