[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] C++ Stuff

Miro Kropacek wrote:

    Everything is fine except when I use vectors so far.  It seems if
    I use vector<T>.push_back() there is a call to an FPU function.
In gdb this results in an EMTTRAP emulation trap and the
Hmm and that is T? No matter, integer or float number, this always happen?

T is a buddy class. The vector is defined in the buddylist class. The failure happens when constructing a buddylist.

class buddy



       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
vector<buddy> 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 { };

The buddylist constructor opens a local file and reads it line by line to add buddies to the list. This is a snippet:

buddy mybuddy; mybuddy.online=0;
               mybuddy.screenname=string(line).substr(1, strlen(line)-2);

It dies on the push_back call.

     It works when I compile with -m68020-60.

This would explain if your T is some float number -- i.e. it would mean there's a bug in floating-point emulation for 68000.

    Does anyone else think it's strange that something as simple as
    vector<T> would need FPU functions?

since push_back is nothing more than adding variable to some (mostly prealloced) space, why not. Imagine you keep it in FP register and you want to add it to this array -- something like fmove.s fp0,(a3)+ is quite normal. Did you try to disassemble it?

I did not. But I will.
MiKRO / Mystic Bytes