Request for sticky

This is a discussion on Request for sticky within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Before we get inundated with threads stating the C++ standard library and C standard library functions are deprecated due to ...

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590

    Request for sticky

    Before we get inundated with threads stating the C++ standard library and C standard library functions are deprecated due to MSVC .NET 2005's error reporting, we should create sticky threads at the top of the forums addressing these very issues.

    The C/C++ standard library is not deprecated as MS says it is.

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    What exactly about the STL is deprecated?

    Code:
    #include <iostream>
    #include <string>
    #include <vector>
    
    using namespace std;
    
    
    int main()
    {
    	vector<string> vstrLst;
    	vstrLst.push_back("Blah");
    	string test;
    	test = "bob";
    	vstrLst.push_back(test);
    
    	vector<string>::iterator vstrIter;
    
    	vstrIter = vstrLst.begin();
    
    	while (vstrIter != vstrLst.end())
    	{
    		cout << *vstrIter << endl;
    
    		vstrIter++;
    	}
    	return 0;
    }
    That compiles without a hitch in 2005.

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Code:
    //#define _SECURE_SCL 0
    
    #include <iostream>
    #include <string>
    #include <vector>
    
    int main()
    {
    std::string source("It might be ugly but at least it's standard!");
    
    std::size_t length=source.length();
    
    std::vector<char> target(length+1,'\0');
    
    //msvc2005 says std::string::copy 'deprecated'. Unless _SECURE_SCL  is
    //#defined as zero
    source.copy(&target[0],length); //(<---msvc2005 say OUCH)
    
    std::cout<<&target[0]<<std::endl;
    }
    Which, with msvc2005 gives rise to:
    Quote Originally Posted by msvc2005
    warning C4996: 'std::basic_string<_Elem,_Traits,_Ax>::copy' was declared deprecated
    If you uncomment the msvc2005 specific preprocessor definition in the example above and recompile it with msvc2005 it magically becomes 'standard' again, losing the warning. Obviously, with a real compiler ( ) like MinGW this isn't an issue.

    So, what msvc2005 means by 'standard' in this context has little to do with the C++ standard but everything to do with an ms specific extension - and this, sadly, is default behaviour for msvc2005.

    However, with a warning like that, a beginner who's new to c++ will understandly probably believe the warning and think that std::string::copy is, in fact, deprecated.

    I don't believe this is good - and I second Bubba's excellent suggestion that before the mad rush of 'msvc2005 tells me it's wrong so it must be' posts really starts in earnest we have something in place to deal with it.

    Read this thread for more details - in particular follow up some of the links posted there to read objections made by smarter people than me regarding why this tactic of microsoft's is potentially more than just a transient annoyance.
    Last edited by Ken Fitlike; 05-07-2006 at 08:44 PM.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  4. #4
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    Quote Originally Posted by Ken Fitlike
    mment the msvc2005 specific preprocessor definition in the example above and recompile it with msvc2005 it magically becomes 'standard' again, losing the warning. Obviously, with a real compiler ( ) like MinGW this isn't an issue.
    Real windows compiler. Seriously, if you plan on writing windows code and want full access to all things windows you're forced to use visual studio, heh. I'm not saying it's a good thing, but it's just something we've got to deal with until some underdog compiler comes around.

    So in the end, valid point. I just wasn't sure what kind of code was causing this problem.

    -edit-
    And to clarify, I've evidently been out of the loop way too long as far as compilers as the name ming was unfamiliar to me, haha. *shakes head and explodes*
    Last edited by jverkoey; 05-07-2006 at 08:08 PM.

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    >>*shakes head and explodes*

    I just had a lemmings flashback

    This is definitely good to know if/when I get 2005 (still using VS 2003)

    Edit: After reading about this C++/CLI crap, all I can say is yuck. I think they're trying to kill C++! Does this remind anyone else of C#? I haven't worked with it a lot, but some of this C++/CLI stuff seems eerily similar.
    Last edited by JaWiB; 05-07-2006 at 09:20 PM.
    "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

  6. #6
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    If Microsoft really wanted C# to catch on, they would have to make it more platform and compiler-independant. For example, I don't use C# nor will I ever because I'm using a Mac. And even if I did switch back to Windows, I would still use C++ to keep my code portable. As long as Microsoft keeps C# proprietary, it's not going to catch on like C/C++ and Java did.

    Even if they do "try to deprecate" C++, they can't kill it!

  7. #7
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Let's wait until/if it becomes a problem before creating _another_ sticky.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  8. #8
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    <cough>FAQ</cough>

    yeah, I'm with Sang here... don't want a whole big long list of stickies again...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  9. #9
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Agreed.

    Just trying to be a bit pro-active. Mark my word these types of threads will pop up more and more as everyone switches to .NET 2005. The help file confuses C++ and CLI so much and makes the line between them so thin, an inexperienced programmer may make the false assumption that Microsoft CLI and/or Microsoft extensions to C++ are actually part of the standard.

    And with Microsoft pressing for standardization of their CLI I look for them to attempt to hijack C/C++, although at the present it does look like there are a great many opponents to CLI being mixed with C++.
    Last edited by VirtualAce; 05-10-2006 at 02:23 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble with client GET request path
    By NuNn in forum C Programming
    Replies: 1
    Last Post: 02-25-2009, 02:34 PM
  2. Can you check what is wrong with this code
    By Ron in forum C++ Programming
    Replies: 4
    Last Post: 08-01-2008, 10:59 PM
  3. my HTTP request handler code correct?
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 04-25-2008, 04:01 AM
  4. denied request
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 09-20-2001, 11:35 PM

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