Like Tree6Likes
  • 1 Post By anduril462
  • 1 Post By brewbuck
  • 1 Post By Salem
  • 2 Post By adeyblue
  • 1 Post By Salem

visual c++ 2010: "step into" steps into C functions problem

This is a discussion on visual c++ 2010: "step into" steps into C functions problem within the Tech Board forums, part of the Community Boards category; Hi all. I've got an unsolvable problem with Code:Blocks(for Windows, Linux version works fine), so am switching to VC++ 2010 ...

  1. #1
    Registered User
    Join Date
    Jul 2012
    Location
    Australia
    Posts
    242

    visual c++ 2010: "step into" steps into C functions problem

    Hi all.

    I've got an unsolvable problem with Code:Blocks(for Windows, Linux version works fine), so am switching to VC++ 2010 Express.

    Anyway, the problem now with VC is that when I click "Step Into", it steps into C functions like printf(). How can I just step through my own code only?

    I've tried to sign up 3 times to the Microsoft forums to ask, but it simply will not let me log in with my username/password.

    From my 15 minutes of googling, I think that I might need to edit the registry, which I am not really comfortable with doing. I am hoping that someone here knows of a setting somewhere in VC that I can turn on or off to fix the problem.

    Thanks in advance.
    IDE: Code::Blocks | Compiler Suite for Windows: TDM-GCC (MingW, gdb)

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,467
    Don't click "Step Into" when you're at a printf call. Click "Step Over", or the equivalent.

    Alternatively, there is probably a way to link against the non-debugging version of the standard C library (I think MS calls it the run-time library, or mscvrt.dll or some such). Such a version would have no debugging symbols or info, so you the "step into" button might just "step over" the standard function calls. That's just a guess though. Unfortunately, I'm a Linux guy, so that's the extent of my knowledge.
    cfanatic likes this.

  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    The debugger in VS will not step into functions that don't have source code, unless you switch to the disassembly view and step directly into the CALL instruction.

    Get used to keeping two fingers on F10 and F11 and pressing the correct key for what you want to do. If you accidentally step into something, you can step out with Shift-F11.
    cfanatic likes this.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    Registered User
    Join Date
    Jul 2012
    Location
    Australia
    Posts
    242
    Thanks for the replies.

    Step Over did the trick. In Code::Blocks, I had never ever used Step Over when debugging, since it only steps into my own functions(which is what I want). In VS, it looks like I will be using Step Over for about 97% of the time(since 97% of the functions in my programs are C library functions). Two different ways of getting the same result.

    VS gives a lot of warnings about unsafe functions. GCC never had such warnings, even when I turned pedantic warnings on. VS is gonna take some getting use to.

    Code:
    main.c(50): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
    main.c(89): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead.
    IDE: Code::Blocks | Compiler Suite for Windows: TDM-GCC (MingW, gdb)

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    > use _CRT_SECURE_NO_WARNINGS.
    Perhaps you could google the last part of your error message.
    It tells you how to turn off all the pointless M$ nagware and vendor lock-in traps.

    > main.c(89): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead.
    The problem with all this nonsense is that they're only SAFE if you know how to use them properly.
    Which is exactly true of the original functions.
    If "noob in a hurry" just passes useless "STFU" parameters to strncpy_s, then it's just as dangerous as strncpy is.

    Code:
    errno_t strncpy_s(
       char *strDest,
       size_t numberOfElements,
       const char *strSource,
       size_t count
    );
    ...
    char buff[10];
    strncpy_s(buff,sizeof(buff),"hello world",10);  // ok, but truncated string
    So some dimwit comes along and tries to "fix" it by doing
    Code:
    strncpy_s(buff,100,"hello world",10);  // yay!, I see the whole string
    It's a small enough buffer overrun to potentially go unnoticed for quite some time.

    All the warm fuzzy feel good of the _s functions won't do you any good at all if you don't know how to use them properly to begin with.
    cfanatic likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    Quote Originally Posted by Salem View Post
    It tells you how to turn off all the pointless M$ nagware and vendor lock-in traps.
    The C standard is a vendor lock-in? You are aware those _s functions are a part of C11, right?

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    Interesting adeyblue, I had thought Microsoft had abandoned any interest in C when they decided not to support C99.

    Still, gotta wait some while before a range of C11 compilers are available before it could be called portable.

    It now is part of C11 as the (optional) Annex K
    Somehow, I can't keep my eyes off the optional.
    jimblumberg likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    Quote Originally Posted by Salem View Post
    > main.c(89): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead.
    The problem with all this nonsense is that they're only SAFE if you know how to use them properly.
    Which is exactly true of the original functions.
    If "noob in a hurry" just passes useless "STFU" parameters to strncpy_s, then it's just as dangerous as strncpy is.

    All the warm fuzzy feel good of the _s functions won't do you any good at all if you don't know how to use them properly to begin with.
    While this is true, Salem, remember that the non_s functions don't give the option to do any security checks at all, while the _s functions do, provided you use them correctly.
    That is reason enough, IMHO, not to dismiss them outright.
    Learn to know your tools. One of THE most important lessons in C (and C++).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 10-25-2010, 11:43 PM
  2. Visual Studio C++ 2005 first task "Create a window"
    By csonx_p in forum Windows Programming
    Replies: 3
    Last Post: 04-15-2008, 05:49 AM
  3. Replies: 14
    Last Post: 12-26-2004, 10:18 AM
  4. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 07:25 AM
  5. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 06:59 AM

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