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 8970277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:42:28+00:00 2026-06-15T17:42:28+00:00

I have a question about setting breakpoints in Visual Studio 2010 Professional. In the

  • 0

I have a question about setting breakpoints in Visual Studio 2010 Professional.

In the struct below, I have an Update() function which, depending on certain conditions, updates the value of it’s member i:

struct A
{
    A(int i) : i(i) {}

    void Update()
    {
        //Update i if some condition is met...
        if(something)
            i += 2;
    }

    int i;
};

int main()
{
    A a(2);

    //Update is usually called periodically...
    a.Update();

    return 0;
}

I would like to set a breakpoint to be hit when i equals 4. The only way I know how to do this is to change the Update() function like so:

void Update()
{
        //Update i if some condition is met...
        if(something)
            i += 2;

        if(i == 4)
            int dummy = 1;
}

Now I can set a breakpoint on the line:

int dummy = 1;

And I will hit a breakpoint when i equals 4. Is there a cleaner or easier way to set a breakpoint in a situation like this? How do I do it without adding in the dummy code?

  • 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-06-15T17:42:28+00:00Added an answer on June 15, 2026 at 5:42 pm

    Set a breakpoint in the usual way with your mouse. This puts a big red dot in the left margin of your code. Now right-click on the big red dot with your mouse. You will see a list of ways you can change your breakpoint. Choose “Condition…”. Then you can enter i==4 into the condition box. You’ll have a breakpoint that breaks at that point when i is 4.

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

Sidebar

Related Questions

I have a question about setting the size of a view to which i'm
I have a question about setting the style attributes for a data cell in
I'm pretty new to coding for iOS and i have a question about setting
I have a question about a class which implements both mouseListener and mouseMotionListener in
I am new to Android development and I have a question about setting weight
I have a question about Eclim and setting it up basically. I've gone through
I have a question about the following canonical object.create method: Object.create = function(o, props)
Following on from this question about setting Culture, I have a similar issue with
I have a simple basic question about C# and inheritance. In the below example,
I have a quick question about the two examples below. Currently I am using

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.