Re: Porting from Windows to Linux
From: Ioannis Vranos (ivr_at_guesswh.at.grad.com)
Date: 06/18/04
- Next message: John Harrison: "Re: Members or not"
- Previous message: Marcin Kalicinski: "Re: Members or not"
- In reply to: Prasanna: "Porting from Windows to Linux"
- Next in thread: Prasanna: "Re: Porting from Windows to Linux"
- Reply: Prasanna: "Re: Porting from Windows to Linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 18 Jun 2004 12:56:53 +0300
Prasanna wrote:
> Hi,
>
> I have been developing some libraries using VC++ 6.0. My work is
> complete now and the code works just fine. It has been tested under
> many circumstances and i have not encountered any problems. Now, I
> would like to port it to gcc. Initially compiling it with gcc produced
> a few errors, asking for some 'const' declarations in places where
> VC++ would not bother to. But then, i was able to compile it and
> create an executable. The problem is the executable crashes when i run
> it.
>
> I tried it with cygwin latest version and g++ in suse 8.1. When i
> tried to debug it with DDD in suse, the program halts when i am
> returning a reference. I checked for possible memory problems, like
> returning a reference for a local variable or chaning the address of
> an allocated memory. But there are none like that.
>
> For example, the place where my program halts is this:
>
> vector<unsigned>& GF::primitive()
> {
> return ir;
> }
>
> where 'ir' is a protected data member of class GF, as shown.
>
> class GF{
> ....
> protected:
> vector<unsigned> ir;
> };
>
> If i try to step through return, it goes inside vector class and i get
> lost.
> I have no idea why this happens. Can someone elighten me on this.
>
> Regards,
> Prasanna.
Does the following code crash to you?
#include <vector>
int main()
{
using std::vector;
class test
{
protected:
vector<unsigned>ir;
public:
vector<unsigned>& primitive() { return ir; }
};
test a;
vector<unsigned> &rir=a.primitive();
}
Regards,
Ioannis Vranos
- Next message: John Harrison: "Re: Members or not"
- Previous message: Marcin Kalicinski: "Re: Members or not"
- In reply to: Prasanna: "Porting from Windows to Linux"
- Next in thread: Prasanna: "Re: Porting from Windows to Linux"
- Reply: Prasanna: "Re: Porting from Windows to Linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|