On Mon, 28 Jun 2004 05:55:16 -0500 (EST)
Filippos Papadopoulos
Hi. I am developing a 3d application in SuSE Linux 9.0 in C++. I ported the application in WinXP using VStudio2003. The fun stuff is that the application executes in Linux but it crashes immediatelly in WinXP. I think i found what is causing the segfault in windows. I have the following classes (which are bad-coded by the way ;) :
I don't see anything off the top of my head, but have you tried
debugging it under the VC Debugger except that in the Cone class you are
using Malloc() in the constructor:
vertices1 = (float *)malloc( sizeof(float) * 2 * (30 + 1) );
vertices2 = (float *)malloc( sizeof(float) * 2 * (30 + 1) );
Upper = (float *)malloc( sizeof(float) * 3 * (30 + 1) );
Lower = (float *)malloc( sizeof(float) * 3 * (30 + 1) );;
You should use the new operator. Here is an example:
vertices1 = new float[2 * (30 + 1)];
I don't think this is your problem, but malloc(3) should not be used in
C++ unless you have no other choice. Remember that malloc(3) is a C
runtime library function (and you should include <cstdlib>). new is an
intrinsic C++ operator.
Also, your public class variables are not initialized in the case where
the empty argument Cone constructor is called, but that would possibly
cause you trouble in Linux as well as Windows.
--
Jerry Feldman