Thread: visual studio 2006 problem

  1. #16
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    or for that matter, do you have the latest VC++ 6.0 service pack installed? SP5 was the last one I saw.

  2. #17
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> ya i have done that, but i am still having that problem..

    Can you post that code so we can test it out? I don't have time to make a complete example, but if you posted one I or others might be able to test it out in VC++ 6.0 to see if it is a problem everywhere or just your configuration.

  3. #18
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    SP5 was the last one I saw
    there was at least 6
    http://www.microsoft.com/downloads/d...displaylang=en
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #19
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    Yes vart I think that might be the problem..

    I will check that..

  5. #20
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I do not remember any major STL issues between 6, 2003 .NET and 2005 .NET save for more standardized behavior under the hood.

    My vector code from 6 ported to 2003 and 2005 just fine.

  6. #21
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    This is a defect in the STL implementation that ships with VC 6.0.
    You could work around the defect like so:
    Code:
        vector<int> v1;
        ...
        vector<int> v2(v1.size());
        std::copy(v1.rbegin(), v1.rend(), v2.begin());
    But a better suggestion is to use another STL implementation like STLport.
    http://www.stlport.org/

    gg

  7. #22
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    I DIDNT GET WHAT "STL implementation " MEANS?

    SHOUL I REINSTALL VISUAL STUDIO 6?

  8. #23
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    It means that there is a bug in the way in which Microsoft (or the company they hired) implemented or programmed the standard template library. I probably did not touch this part of the STL impl in my code which is why I never had trouble.

  9. #24
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    you should verify that
    VS is installed
    SP6 is installed
    Platform SDK is installed
    Platform SDK paths are shown in a first row in the Tools/Options/directories for Bin/Lib/Include dirs
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  10. #25
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    C++ compilers come shipped with the standard library of classes, functions, etc, that you use in your program. That library is referred to as the implementation. Your STL implementation is just the standard library code that came with your compiler.

    It is possible to switch to another library without changing your compiler. That is what Codeplug and others are suggesting. However, that is a major change, and if your customer is unwilling or unable to change from VC++ 6.0, then they might not want to change their standard library implementation either. If they were willing to change, they should just upgrade to a modern compiler that comes with a modern standard library.

    Reinstalling won't help, since Codeplug is saying that there is a bug in the VC++ library, so even if you reinstall it will still be there.

    I would suggest using the workaround he suggested and trying to convince your customer to allow you to use a modern compiler. VC++ 2003 (version 7.1) is very good, and VC++ 2005 Express is also good and free. There is even a VC++ 2008 out now that should be considered.

  11. #26
    Registered User
    Join Date
    Dec 2007
    Posts
    78
    thanks for all the help, i will try to find solution based on your suggestions....

  12. #27
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    I have MSVC 6 on a computer, here are the first couple dozen lines of code from the vector header file (SP6), pay attention to the lines I've colored (they are the constructors):
    Code:
    // vector standard header
    
    #if     _MSC_VER > 1000
    #pragma once
    #endif
    
    #ifndef _VECTOR_
    #define _VECTOR_
    #include <climits>
    #include <memory>
    #include <stdexcept>
    #include <xutility>
    
    #ifdef  _MSC_VER
    #pragma pack(push,8)
    #endif  /* _MSC_VER */
    _STD_BEGIN
    		// TEMPLATE CLASS vector
    template<class _Ty, class _A = allocator<_Ty> >
    	class vector {
    public:
    	typedef vector<_Ty, _A> _Myt;
    	typedef _A allocator_type;
    	typedef _A::size_type size_type;
    	typedef _A::difference_type difference_type;
    	typedef _A::pointer _Tptr;
    	typedef _A::const_pointer _Ctptr;
    	typedef _A::reference reference;
    	typedef _A::const_reference const_reference;
    	typedef _A::value_type value_type;
    	typedef _Tptr iterator;
    	typedef _Ctptr const_iterator;
    	typedef reverse_iterator<const_iterator, value_type,
    		const_reference, _Ctptr, difference_type>
    			const_reverse_iterator;
    	typedef reverse_iterator<iterator, value_type,
    		reference, _Tptr, difference_type>
    			reverse_iterator;
    	explicit vector(const _A& _Al = _A())
    		: allocator(_Al), _First(0), _Last(0), _End(0) {}
    	explicit vector(size_type _N, const _Ty& _V = _Ty(),
    		const _A& _Al = _A())
    		: allocator(_Al)
    		{_First = allocator.allocate(_N, (void *)0);
    		_Ufill(_First, _N, _V);
    		_Last = _First + _N;
    		_End = _Last; }
    	vector(const _Myt& _X)
    		: allocator(_X.allocator)
    		{_First = allocator.allocate(_X.size(), (void *)0);
    		_Last = _Ucopy(_X.begin(), _X.end(), _First);
    		_End = _Last; }
    	typedef const_iterator _It;
    	vector(_It _F, _It _L, const _A& _Al = _A())
    		: allocator(_Al), _First(0), _Last(0), _End(0)
    		{insert(begin(), _F, _L); }
    Those are the only constructors that I found in the file and you should notice that there is no version of the constructor that seems to handle reverse iterators. The last one does seem to handle forward iterators, but no reverse iterator version seems to exist. I could have missed something though, didn't look under every rock.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  13. #28
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    A reverse_iterator works like any other iterator and should be handled by the last constructor show, correct?

  14. #29
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Bubba View Post
    I do not remember any major STL issues between 6, 2003 .NET and 2005 .NET save for more standardized behavior under the hood.

    My vector code from 6 ported to 2003 and 2005 just fine.
    Did you compile at Warning Level 4?
    VC++ 6.0 should give you dozens (or hundreds...) of warnings & errors if you use STL with Warning Level 4.

  15. #30
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Quote Originally Posted by Daved View Post
    A reverse_iterator works like any other iterator and should be handled by the last constructor show, correct?
    The Standard specifies that constructor as:
    Code:
    template <class InputIterator>
    vector(InputIterator first, InputIterator last, const Allocator& = Allocator());
    Since VC++ 6.0 doesn't support template constructors very well (if at all), they just implemented a vector::const_iterator version of the constructor.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. Console Font Size
    By bradszy in forum Windows Programming
    Replies: 34
    Last Post: 04-26-2008, 07:09 AM
  3. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM