Win98/NT and Visual C ver. 4/5 incompatibility?
Posted on 1998-09-30
I have C++ code that compiles and executes correctly on a Windows 98 machine, using either MS Visual C++ version 4 or 5 as the compiler.
I copied the project to a Win NT 4.0 machine, and recompiled the code using MSVC version 4. As expected, the compile was successful. However, executing the code gave a run time error: error writing to location 0x00000000 (i.e. NULL). When I recompile the project with MSVC version 5, it compiles and runs correctly.
Debugging the version 4 project shows the error to be at the last line of the following code:
my_array = new int[some_variable];
my_array = my_data;
which implies, since debugging indicates that my_array points to NULL, that the memory was not allocated during runtime. Interestingly enough, when I step through the code in Visual C 4, it exectues fine.
Normally, I would just use Visual C++ 5, but I need to link a few libraries which were compiled for 4.
The code is compiled as a Win32 "command-line" executable, and consists of ANSI C/++, nothing Windows-specific.