Hi everyone,

I am not quite sure whether this is on or off-topic but here goes anyway.
In school we unfortunately use Turbo C++ v3.0 for our C++ development work
(at least not Visual C++, I should be thankful). So I tested my machine
problem (or whatever's finished of it) using Turbo C++. Things work great.
On my Linux box, which has both g++ 2.95.4 (20010902) and 3.0.2
(20010908), though, the program segfaults.

I compile the program using any of the following and get consistent
results:

$ g++ -Wall -o mp mp.cpp
$ g++-3.0 -Wall -o mp mp.cpp
$ gcc -Wall -o mp mp.cpp
$ gcc-3.0 -Wall -o mp mp.cpp

It's interesting to note that none of these return errors, and it doesn't
matter whether I use g++ or gcc despite the fact that the program uses
classes.

Using what very little I know of gdb, I "debugged"[1] it and found that it
segfaults in card::value_(), which is a function in class card. Nothing
great about this function: it simply returns the value of a private
variable that I don't want modifiable after the constructor function does
its work.

My hunch is that things are breaking with my pointers. In particular I
have an array of pointers to "class card". I use pointers instead of
simply "class card"s so that I can subsequently change any element by
deleting it then creating a new card.

Any known issues with pointers to classes in Linux? Or pointers to classes
in general?

Gracias mi amigos y amigas! :)

 --> Jijo

Notes:

[1] I debugged the program by doing the following:

$ gdb ./mp
$ run

And it returns:

Program received signal SIGSEGV, Segmentation fault.
0x0804965e in card::value_ ()

--
Federico Sevilla III  :: [EMAIL PROTECTED]
Network Administrator :: The Leather Collection, Inc.
GnuPG Key: <http://jijo.leathercollection.ph/jijo.gpg>

_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to