Sometimes, I made a typo in one place of my program code:
int a = 10; char* b = new char(a);
The error is obvious: I wrote () instead of []. The strange thing is ... the code compiled fine, it worked fine in the debugger. But the compiled .exe outside the debugger crashed an instant after the function with these lines was executed.
Is the second line of code really legitimate? And if so, what does this mean for the compiler?
source share