c++ - Exception Handling : But do not end up in the catch block -


i'm getting unhandled exception in function. function called many times.

try {   unsigned char* b1 = new unsigned char[length];  //<---here   unsigned char* b2 = new unsigned char[length];   //do stuff doesn't seem throw exception...then @ end   delete[] b1;   delete[] b2; } catch (...) {     cout<< "error..." <<end;  } 

thing is, unhandled exception occurs @ random times. breaks on first statement. , other issue is: why isn't caught? visual studio halts , i'm in new.cpp.

and third question/issue is: how can track down problem? length never uninitialized amount; around 512.

seems cout << ... requires memory allocation, cannot it. configure debugger break execution when exception thrown (as other people suggest) , see thrown , @ point. btw, sutter writes shouldn't try catch memory allocation exceptions @ - it's quite hard needed error reporting without memory allocations, , these fail, why bother. (and maybe not these exceptions @ - virtual memory & swapping such wonderful things...)


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -