Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7572567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:57:26+00:00 2026-05-30T15:57:26+00:00

I am working on the project written in c++ that does some manipulations on

  • 0

I am working on the project written in c++ that does some manipulations on the text lines. One of the lines causes program to enter infinite loop in on of the functions (2000+ lines of code). The reason is that a conditions, checked by another 2000+ line function fails. I know that if I remove quote symbols in the original line everything works fine (check works fine, no infinite loop). But the logic of these two huge functions is just inconceivable and the person who wrote these methods is no longer available. So, basically, what I am left with is to go step-by-step and compare what’s going with a bad line and a good line, what paths are taken by the program.

Are there any tools, which can print the execution path taken, so I don’t have to compare every step manually? And what is the general technique in grasping the loging of a huge unknown function?

P.S. Using Windong and Visual Studio

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:57:27+00:00Added an answer on May 30, 2026 at 3:57 pm

    I’ve worked on a C++ project with functions over 4000 lines of code in a function, so I feel your pain! I didn’t have the option at the time, but what I would do be to isolate the big functions into a new project so you can play around with them without damaging the main codebase.

    Then I’d unit test it to the max, passing in lots of different inputs, and assert that the output is what happens on the first run. Once you’re happy that you’ve covered as much as reasonably possible, then start refactoring. Choose some small bits of the code that you do understand, and extract it into a well named method. Good candidates are if statements with more than one condition, the contents of loops and chunks of code preceded by a comment. Make sure the new function names are self-commenting, e.g. CopyContentsOfStringIntoBuffer()

    This helps in a couple of ways – firstly, you’ll be able to see your main functions getting smaller. Secondly, you won’t need to read bits of code you already understand. Thirdly, the code becomes much more readable.

    Once you’ve done that for the bits you do understand, you can do a similar thing for the code you don’t understand. Extract it into a new function, and write some unit tests with various inputs and see what the outputs are. Once you understand, rename the function to reflect your understanding.

    Keep running your original unit tests to ensure that you don’t break anything during the refactoring.

    You can write more unit tests to verify the new functions. Once you’re happy, you can move the code back into the original project (with the tests). Your future self with thank you on a regular basis.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working a project with many NUnit tests, that were already written long
I am working on a software development project that uses code written primarily in
I am working a project that does not have a trunk / branches /
I'm working on a project, written in Java, which requires that I build a
I am currently working on a mantenance project that is written in Java. We
I'm currently working on my project which consists of front and back-end written in
I've written a url validator for a project I am working on. For my
I'm currently working on a hobby project, written in Java, containing about two different
While working a project tonight, I ended up using one .js resource file for
I'm currently working on project with Haskell, and have found myself some trouble. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.