VS 6 Vs 2005

This is a discussion on VS 6 Vs 2005 within the C++ Programming forums, part of the General Programming Boards category; For 5 years I used VS 6 now I wanna begin with 2005. Can anybody lead me to a resource ...

  1. #1
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231

    Question VS 6 Vs 2005

    For 5 years I used VS 6 now I wanna begin with 2005. Can anybody lead me to a resource about the differences? For example:
    Code:
    for(int i =0;  i<10; i++);
    cout<<i;
    Works in 6 but not 2005 (The identifier i is not defined outside the for block). In addition some old functions have new replacements. What are those?
    Last edited by siavoshkc; 07-03-2006 at 12:22 AM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  2. #2
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    remove the ";" after for !!!
    New versions are better like always, Why i don't know, but they are!
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  3. #3
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    >>In addition some old functions have new replacements. What
    >>are those?

    Microsoft are being a real pain in the *** by redesigning some
    older functions and adding buffer size parameters and the like.
    The functions are fine, its just that only that compiler will
    recognise them, leading to portability issues.

    Additionally, the compiler is set by default to warn you about
    using an unsafe function every time that one of its own functions
    could be used instead - it claims that the old functions are
    deprecated - this couldn't be further from the truth as far as the
    standard goes - I think Microsoft is just trying to suck people into
    their line of products.

    There is a way to get rid of the deprecation warnings - do the
    following:

    Project -> <ProjectName> Properties -> Configuration Properties
    -> C/C++ -> Preprocessor, and under Preprocessor Definitions
    you should see a few definitions such as WIN32; _DEBUG;
    (depending on your project type), add the following to that list:

    _CRT_SECURE_NO_DEPRECATE

    and it'll turn off those annoying warnings. Unfortunately it applies
    to only one project, I don't think you can turn it off for all projects
    by default - pity.
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,475
    Regarding the for loop,

    When VC++ 6 shipped the 98 standards had been only recently released. There was no time(?) to adopt them fully. 98 standards state that the for loop (among others) defines its own scope. To this day you still have the pre-standard behavior option. It's compiler defined. Check the help files.

    But it took Microsoft 8 years to finally make this the default behavior. That's why your code breaks on VC++ 2005. Thank goodness it does.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    I need a resource on the "MS newly designed functions" and "MS new default behaviors".
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  6. #6
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by siavoshkc
    I need a resource on the "MS newly designed functions" and "MS new default behaviors".
    your best bet is to look them up in MSDN. Myself, I just use a pragma to ignore that warning.

  7. #7
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by Richie T
    *stuff about the new strcpy_s functions*
    actually those functions are a Good Thing (tm). strcpy is one of the most evil functions known to man in terms of the amount of suffering it has caused. It's responsible for untold hours of lost programmer productivity looking for buffer overruns, any number of security holes when those buffer overruns weren't found and even one or two deaths due to crashing medical/safety systems.

    MS has actually proposed those functions to the C and C++ committees for inclusion in the next version of the standard and there's a very good chance that they (or a version very like them) will be accepted. In the meantime, warning you when you use strcpy is a good thing. Besides, strcpy has NO place in a C++ programmers code.

    as for the for loop, Mario F. is right, but you can specify this behaviour on vs2003 with a compiler option. I believe you can even do it with vc6, but it's been so long since I escaped that crappy compiler I can't remember.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  8. #8
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by ChaosEngine
    . Besides, strcpy has NO place in a C++ programmers code..
    Whenever I see someone state an absolute golden rule such as that one I see them eat their words when exceptions occur. There are many cases where it is not possible to avoid using strcpy() or some form of it. Not everything in this world can be represented by std::string class, or other such classes. There are several occations I can easily think of where it is necessary for c++ programs to resort to C strings and string functions.

  9. #9
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    I agree with the sentiment of the new Microsoft functions, and if
    they were introduced into the next C/C++ standards I wouldn't
    have any beef with them, but as long as they remain non
    standard, I will avoid using them. My main problem with them is
    the repeated warnings the compiler throws at you for using
    standard code - that is not right IMO. Admittedly, there are
    functions that you should not use under any circumstances
    (gets () being a personal favourite example), but I want to have
    the freedom to use it without getting warnings.
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  10. #10
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    > There are many cases where it is not possible to avoid using strcpy() or some form of it.

    Is there any case where you couldn't use strncpy instead?
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  11. #11
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by JaWiB
    > There are many cases where it is not possible to avoid using strcpy() or some form of it.

    Is there any case where you couldn't use strncpy instead?
    Exactly. I am not arguing against c functions in general (although any c function that uses a buffer should be treated with care), but strcpy is just downright EVIL!!

    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  12. #12
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    Richie T is right. Warning for standard functions and encouraging non-standards is unacceptable. We(C/C++ programmers) all know that if you don't be careful of what you are writing, your program won't work as well as it should. It is the nature of C/C++. strcpy() is a simple function, any other function will be more huge and slower. When I write a C/C++ program, simplicity and speed are two important goals.
    It's only my idea. I have not seen a function performance test yet, but when you write in C/C++ YOU should be careful not MS.
    MSVS2005 setup was slow (and it began from the beginning when my PC freezed during the installation). I really want to know why (I think MS used its own functions.).
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  13. #13
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    By the way, there is a sticky on the GD written by Bubba.

    Also: Request for sticky

    I don't think I'm so much opposed to the warnings as to the claim that the functions are "deprecated" when the standard does not say they are.

    Edit: And anyways, I'm still using VS 2003, so I haven't experienced any of this first hand
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  14. #14
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    As I said previously, you can remove those warnings with a pragma
    Code:
    #pragma warning(disable: 1234) // 1234 is a warning number
    Just put the above line in stdio.h before any include files. replace the number 1234 with the actual warning number (I don't reall its exact warning number). You won't see those warnings again.

    strcpy() is only evil to those who don't know how to respect it and use it properly. You can't just go around using functions like that mindlessly -- you have to put a minimal amount of thought into it.

  15. #15
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,475
    Quote Originally Posted by Ancient Dragon
    strcpy() is only evil to those who don't know how to respect it and use it properly. You can't just go around using functions like that mindlessly -- you have to put a minimal amount of thought into it.
    ... Like many other standard library facilities C++ has to offer. Microsoft might as well call pointers, arrays, system() and others deprecated.

    However truth is that any unsuspecting C++ programmer, when confronted with that warning, will realize a few things:

    - It's a warning. Not an error. The program will compile. and since it's odd to him, he will click the warning and hit F1 to get help on it's meaning.
    - He will then known what is really meant by "deprecated". The term is being used in the context of VC++ compiler, not that of the C++ standards.
    - He will know how to turn it off.
    - He will know what is VC++ 2005 proposing as replacements.

    So really this isn't an issue any bigger than gcc allowing arrays to be declared with nonconst variable sizes, for instance. And I don't see many cries of disgust about this as I hear about a simple warning VC++ 2005 is issuing.

    Let's move on...
    Last edited by Mario F.; 07-04-2006 at 06:10 AM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stdin in Visual Studio 2005 vs. 2003
    By Trev614 in forum C Programming
    Replies: 5
    Last Post: 06-23-2008, 02:44 PM
  2. If you must port to .NET 2005, read this thread.
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-22-2007, 06:51 AM
  3. MVC++ ver 6 or Microsoft Studio 2005?
    By franziss in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 09-29-2006, 01:35 PM
  4. Warning to all those wishing to port to .NET 2005
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 05-07-2006, 09:29 PM
  5. Really basic string operation
    By bobthebullet990 in forum C Programming
    Replies: 6
    Last Post: 11-28-2005, 04:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21