Thread: MSVC 2k3 7.1 bug?

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    MSVC 2k3 7.1 bug?

    Code:
    class ENTITY
    {
    public:
    ..........
    			static list<ENTITY*> m_universe; // All existing entities.
    
    			ENTITY(unsigned int speed, double mass, double lift, double friction)
    			{
    				// Physical properties
    				m_speed = speed;
    				m_mass = mass;
    				m_friction = friction;
    				m_lift = lift;
    				m_tick_count = infinite-m_speed;
    
    				m_universe.push_back(this); // <--- read error at 0x00000004
    				last_tick_collided = false;
    			}
    ........
    };
    Right here:
    Code:
    	void _Insert(iterator _Where, <--- The 'this' pointer is correct.
    		const _Ty& _Val)
    		{	// insert _Val at _Where
    		_Nodeptr _Pnode = _Where._Mynode();
    		_Nodeptr _Newnode = _Buynode(_Pnode, _Prevnode(_Pnode), _Val); <--- exception here
    		_Incsize(1);
    		_Prevnode(_Pnode) = _Newnode;
    		_Nextnode(_Prevnode(_Newnode)) = _Newnode;
    		}
    Not to mention that I've also been getting these errors:
    error C2440: 'initializing' : cannot convert from 'std::list<_Ty>::iterator' to 'std::list<_Ty>::iterator'
    with
    Code:
    list<ITEM_TYPE>::iterator item = m_items.end();
    where ITEM_TYPE is a class template argument... I have to resort to memcpy'ing it.

    Are these compiler errors or what?
    Last edited by RITZ; 03-26-2006 at 12:57 AM.

  2. #2
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Hey Ritz,

    I know you know better than using namespace std; in your headers, but still I hate to make any assumptions. You need to use std:: in front of list.

    Code:
    static std::list<ENTITY*> m_universe; // All existing entities.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> list<ITEM_TYPE>::iterator item = m_items.end();

    Perhaps that should be:

    typename list<ITEM_TYPE>::iterator item = m_items.end();

    Also, are you creating any global ENTITY's that might be constructed before the static list is constructed?

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    10
    Quote Originally Posted by Darryl
    Hey Ritz,

    I know you know better than using namespace std; in your headers, but still I hate to make any assumptions. You need to use std:: in front of list.

    Code:
    static std::list<ENTITY*> m_universe; // All existing entities.
    Hey Darryl. Who says it's a header? :P I am using std::list;

    Quote Originally Posted by Daved
    Also, are you creating any global ENTITY's that might be constructed before the static list is constructed?
    .... This is the dumbest thing I've done in a long time. Thanks Daved, I'm sure that is the problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ATL bug of CComPtr?
    By George2 in forum Windows Programming
    Replies: 6
    Last Post: 04-07-2008, 07:52 AM
  2. MSVC 7.1 Compile time
    By cboard_member in forum Tech Board
    Replies: 10
    Last Post: 08-05-2006, 04:04 PM
  3. MSVC 7.1: Template specialisation??
    By cboard_member in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2006, 10:19 AM
  4. Allegro with MSVC 7.1!
    By Sentral in forum Game Programming
    Replies: 4
    Last Post: 03-08-2006, 04:10 AM
  5. GCC (cygwin) much faster than MSVC, Borland?
    By Sargnagel in forum C Programming
    Replies: 15
    Last Post: 08-05-2003, 03:15 AM