Dear Qtians!
I have one question about new.
How a way pbOk handle error when bad allocation exists due to some reason.
I am not seeing any try{ }catch{ } block for that.
Printable View
Dear Qtians!
I have one question about new.
How a way pbOk handle error when bad allocation exists due to some reason.
I am not seeing any try{ }catch{ } block for that.
It depends on you. If you can recover from a lack of memory and you are worried they might happen, feel free to do it.
Most probably you have an error in your code (a dangling pointer perhaps) that is completely unrelated to exceptions thrown by operator new or lack of memory.Quote:
In some cases, if I does not use try{} catch{} for new and due to some reason object does not allocated and when I destroy object it gives segmentation fault.