ahodgson@athena.mit.edu (Antony Hodgson) (03/23/91)
I just reported the following bug involving precompiled headers to Borland.
File: bar.h
class foo { public: foo() {} };
class bar { public: bar( foo = foo() ) {} };
File: main.cpp
#include <iostream.h>
#include "bar.h"
main()
{
bar b;
cout << "Done.\n";
}
If one builds this program with precompiled headers ON, then it runs fine.
If you then touch main.cpp and recompile, the .obj and .exe files have
a different size and the program crashes your system when you run it.
This happens in the IDE under any memory model and regardless of the
state of the DEBUG INFO IN OBJ option. Interestingly, if class foo
is eliminated and the bar constructor changed to bar( int = 1 ), all
is fine. Turning precompiled headers off solves the problem, but that
definitely defeats the purpose of precompilation.
Tony Hodgson
ahodgson@hstbme.mit.edu
shaunc@gold.gvg.tek.com (Shaun Case) (03/28/91)
In article <1991Mar22.170134.11852@athena.mit.edu> ahodgson@athena.mit.edu (Antony Hodgson) writes: >I just reported the following bug involving precompiled headers to Borland. [bug deleted] >If one builds this program with precompiled headers ON, then it runs fine. ... >is fine. Turning precompiled headers off solves the problem, but that >definitely defeats the purpose of precompilation. I had a completely different problem with the precompiled headers in BC++ 2.0, which I reported to Tech Support. I had an application in which command line arguments suddenly quit working. That is, argc was zero, and argv[1] (and even argv[0]) was/were NULL. Turning off the precompiled headers fixed it; another thing that fixed it was changing one of my #defines. It seems that someone else had called in before me, and had the following line as the first line in one of his/her #include files: #define A 0 The closest thing I could find was the line #define VERSION "0.00" as the first line in one of my include files. I changed it to #define VERSION "1.00" and everything started working again, both with and without the precompiled headers. However, as my application continued to grow, the problem cropped up again; I went through #define VERSION "1.10" and #define VERSION "1.11" as my code and data increased. Each time it sovled the problem temporarily. Now, I am using #define VERSION "1.111" and am wondering what version my program will be when it is released! :-) If it happens again, I am going to insert a new line like #define DUMMY 1 and see if that helps. What's really odd is that the other person's problem dealt with a numerical value, and mine deals with a string, although the symptoms are the same. Anyhow, if anyone is having trouble with an argc=0 bug, try either eliminating use of precompiled headers, or changingany #define in an include file that is 1) The first #define in the file, AND 2) defined to be 0 or some string with zeros in it. Happy hacking! Shaun. -- Shaun Case: shaunc@gold.gvg.tek.com or atman%ecst.csuchico.edu@RELAY.CS.NET or Shaun Case of 1:119/666.0 (Fidonet) or 1@9651 (WWIVnet) --- It's enough to destroy a young moose's faith!