commedo's blogger

Wednesday, September 01, 2004

[PROGRAMMING TIPS] Compilation Option for MSVC 2000 (v6)

Having problem with application (unhandled exception) run on MS Windows 2000/XP/2003?

One of the solution key is using default option (Project Settings > tab C++) while compiling application or DLL using MSVC.
DO NOT use Maximize speed nor Minimize size options to compile because these options are causing any exception handling codes such as try...catch, pretend not to be executed properly, and then system will generate error.

You may simply try compiling the following code using compile options (default, maximize speed, minimize size) and compare the execution results:


#include <stdio.h>
#include <string.h>

int main ()
{
char* c;
try {
printf("test core dump\n");
strcpy(NULL, NULL);
} catch (...) {
printf("YUPI, core dump\n");
}
return 0;
}

Reference:
Yusron Hilmy

0 Comments:

Post a Comment

<< Home