CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Angry msvc9 express copy/paste issue

    Code:
    #ifndef SEQUENCE_H
    #define SEQUENCE_H
    #include<algorithm>
    #include<ctime>
    #include<cstdlib>
    #include<cstdio>
    #include"typedefs.h"
    namespace GT
    {
    template < uint N >
    class Sequence
    {
    private:
    IntVec sequence_;
    Sequence( const Sequence& ); 
    Sequence& operator =( const Sequence& );
    public:
    Sequence()
    {
    sequence_.reserve( N );
    for ( int i = 1; i <= N; ++i )
    {
    sequence_.push_back( i );
    }
    Shuffle();
    }
     
    const IntVec& GetSequence() const
    {
    return sequence_;
    }
    staticvoid Randomize( uint def = 0 )
    {
    if ( def == 0 )
    def = static_cast<uint>( std::time( NULL ) );
    std::srand( def );
    }
     
    void Shuffle()
    {
    std::random_shuffle( sequence_.begin(), sequence_.end() );
    }
    };
    } // end namespace
    #endif// header guard
    The above was pasted from msvc9 express. As you can see this destroys all indentation and even sometimes joins keywords together losing the space between them. What can i do? Others who use msvc9 dont seem to have this problem. I have already told it to use spaces rather than tabs as in all previous versions of msvc I have used. The syntax colouring is nice, but not at the expanse of destroying structure!
    Anyone know the fix for this issue??
    Also it appears this text is green as the last line of code is a comment. Very strange behaviour.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

  2. #2
    Join Date
    Feb 2007
    Location
    Craiova, Romania
    Posts
    326

    Re: msvc9 express copy/paste issue

    Select all the code (CTRL-A) and press CTRL-Shift-F.

    later edit: sorry, it is CTRL-K, F (meaning CTRL-K and then F)
    Last edited by marceln; December 31st, 2008 at 06:45 PM.

  3. #3
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: msvc9 express copy/paste issue

    Didn't work, that just formatted the code into a style that I dont like and still when pasted same problems occurred. Indentation toally destroyed. Text after still green. This is very annoying.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

  4. #4
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,758

    Re: msvc9 express copy/paste issue

    There is not enough detail to really respond. Without seeing the original file and seeing how you pasted it, we can't replicate what you did. I'd be inclined to say the issue is not a vBulletin issue since nobody else seems to be having it......

    In looking at the code in your post, you seem to be color coding your text green, etc.

    Again, more specifics would be needed to see what is actually happening.

    Brad

  5. #5
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: msvc9 express copy/paste issue

    The colour coding is done by msvc not me

    This is exactly how it pastes from msvc9 and I swear it doesn't look like that in the compiler.

    Code pasted from msvc7.0
    Code:
    #ifndef SEQUENCE_H
    #define SEQUENCE_H
    
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <cstdio>
    #include "typedefs.h"
    
    namespace GT
    {
        template < uint N >
        class Sequence
        {
            private:
                IntVec sequence_;
    
                Sequence( const Sequence& );          
                Sequence& operator =( const Sequence& );
    
            public:
                Sequence()
                {
                    sequence_.reserve( N );
                    for ( int i = 1; i <= N; ++i )
                    {
                        sequence_.push_back( i );
                    }
                    Shuffle();
                }
                                          
                const IntVec& GetSequence() const
                {
                    return sequence_;
                }
    
                static void Randomize( uint def = 0 )
                {
                    if ( def == 0 )
                        def = static_cast<uint>( std::time( NULL ) );
                    std::srand( def );
                }
                
                void Shuffle()
                {
                    std::random_shuffle( sequence_.begin(), sequence_.end() );
                }
        };
    
    } // end namespace
    
    #endif // header guard
    Same code pasted from msvc9 express.
    Code:
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <cstdio>
    #include "typedefs.h"
    
    namespace GT
    {
        template < uint N >
        class Sequence
        {
            private:
                IntVec sequence_;
    
                Sequence( const Sequence& );          
                Sequence& operator =( const Sequence& );
    
            public:
                Sequence()
                {
                    sequence_.reserve( N );
                    for ( int i = 1; i <= N; ++i )
                    {
                        sequence_.push_back( i );
                    }
                    Shuffle();
                }
                                          
                const IntVec& GetSequence() const
                {
                    return sequence_;
                }
    
                static void Randomize( uint def = 0 )
                {
                    if ( def == 0 )
                        def = static_cast<uint>( std::time( NULL ) );
                    std::srand( def );
                }
                
                void Shuffle()
                {
                    std::random_shuffle( sequence_.begin(), sequence_.end() );
                }
        };
    
    } // end namespace
    
    #endif // header guard
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

  6. #6
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: msvc9 express copy/paste issue

    Hmmm thats wierd. No syntax colouring now. Now I really have no idea whats going on, I havent changed anything in the editor at all.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

  7. #7
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: msvc9 express copy/paste issue

    Snippet just posted in last reply but this time from reply to thread
    Code:
    const IntVec& GetSequence() const
    {
    return sequence_;
    }
    staticvoid Randomize( uint def = 0 )
    {
    if ( def == 0 )
    def = static_cast<uint>( std::time( NULL ) );
    std::srand( def );
    }
    
    void Shuffle()
    {
    std::random_shuffle( sequence_.begin(), sequence_.end() );
    }
    

    Seems conclusive.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

  8. #8
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,758

    Re: msvc9 express copy/paste issue

    I confirmed. This is a vBulletin issue. We'll have to report the bug to them.

    I've removed some of your testing posts (they should have been done in the testing forum). I've also moved this thread to the feedback forum so that our Forum Manager can see it.

    Brad!
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

  9. #9
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: msvc9 express copy/paste issue

    TYVM Brad.

    I expected those posts to be deleted after you had seen them.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured