From mint-bounce@lists.fishpool.fi Sat Feb 14 11:17:53 2009 Message-ID: <4996EE34.8090002@freesbee.fr> Date: Sat, 14 Feb 2009 17:15:48 +0100 From: =?ISO-8859-1?Q?Vincent_Rivi=E8re?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: mint CC: Mark Duckworth Subject: Re: [MiNT] C++ Stuff References: <499665F5.809@atari-source.org> <4996E70E.1030603@atari-source.org> In-Reply-To: <4996E70E.1030603@atari-source.org> Content-Type: multipart/mixed; boundary="------------030706000701090200060302" X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: vincent.riviere@freesbee.fr Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: This is a multi-part message in MIME format. --------------030706000701090200060302 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Mark Duckworth wrote: > T is a buddy class. The vector is defined in the buddylist class. The= =20 > failure happens when constructing a buddylist. In such case, write a small testcase. I did it for you. I made a copy/paste of your snippets in a single=20 source file, plus some glue (see attached file). For me, it works perfectly. I cross-compiled the source using gcc 4.3.3=20 and I ran it on Steem (nearly perfect STe emulator - of course without=20 FPU !) m68k-atari-mint-g++ vect.cpp -o vect.tos (go to the emulator) vect Not crashed ! screenname =3D bcdef Try this source on your system to check it is not a compiler issue. I really think your problem is elsewhere. Maybe you trashed the stack before calling push_back ? --=20 Vincent Rivi=E8re --------------030706000701090200060302 Content-Type: text/plain; name="vect.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vect.cpp" #include #include #include #include using namespace std; class buddy { public: string screenname; unsigned short int selected; unsigned short int highlighted; unsigned short int online; unsigned short int away; struct aim_userinfo_s *userinfo; string prof; string info; int info_display_offset; void is_now_online(); void is_now_offline(); void is_now_away(); void is_now_back(); }; class buddylist { public: vector thelist; buddy* find_by_screenname(string in_sn); void add(string in_sn); buddylist(bool fromdisk); void remove(string in_sn); void print(); void save_to_disk(); string oscar_string(); class AnError { }; }; buddylist::buddylist(bool fromdisk) { const char* line = "abcdefg"; buddy mybuddy; mybuddy.online=0; mybuddy.selected=0; mybuddy.away=0; mybuddy.highlighted=0; mybuddy.screenname=string(line).substr(1, strlen(line)-2); mybuddy.userinfo=NULL; mybuddy.prof=""; thelist.push_back(mybuddy); cout << "Not crashed ! screenname = " << thelist[0].screenname << endl; } int main(int argc, char* argv[]) { buddylist bl(true); return 0; } --------------030706000701090200060302--