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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:33:34+00:00 2026-06-01T03:33:34+00:00

I am encountering some really odd behavior with my code. It is throwing an

  • 0

I am encountering some really odd behavior with my code.

It is throwing an access violation error when I run it and through the debugger I managed to find out the line which is causing it:

for( int x=0; x<width; x++) {

    int current = edgeKernelXY(left+x,top+y,true,0);
    ....
}

I placed a debug point in the method edgeKernelXY and the code never even got into the method.

The next thing I checked was what the values that I am passing into it are. Left, top and y seem normal enough. However according to the debugger, x = 19840810 and current = 19840810. I don’t understand how this could have happened especially if I declared x to be 0 at the beginning of the loop. Width is correct at 40.

x and current have not been declared anywhere else in scope of the forloop. What could be going wrong here?

EDIT:

I changed the code as follows:

    for( int x=0; x<width; x++) {
        int current = edgeKernelXY(left,top+y,true,0);
        if( current > THRESHOLD && 
            edgeKernelXY(left+x,top+y,true,1) > THRESHOLD &&
            edgeKernelXY(left+x,top+y,true,2) > THRESHOLD ) {
        } else {
            current = 0.0f;
        }

Specifically I changed left+x on the first call of edgeKernelXY to just left. This seems to run and the second call to edgeKernelXY shows x set correctly to 0. However the behavior is not what I want. Left + x still gets me crazy values for x which is causing an access violation.

    for( int x=0; x<width; x++) {

        int current;
        current = 0;
        current = edgeKernelXY(left+x,top+y,true,0);

Also shows problems with current.

  • 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-01T03:33:35+00:00Added an answer on June 1, 2026 at 3:33 am

    Since you’re debugging a release build you can’t depend on the debugger showing the right values in watch windows, etc. Debugging release mode can be done, but is considerably trickier. Generally it requires looking at the disassembly to understand what’s going on and what the state of things is (ie., x is almost certainly being kept in a register).

    If you can’t perform a full debug release, you can still get a much better debugging experience by building with optimizations turned off (which can be done in release builds and can be done without linking to debug libraries).

    Assuming that you’re building in the IDE, just go into the project settings and change the C/C++ - Optimization - Optimization value to Disabled (/Od).

    If this causes a problem by setting it project-wide (which it shouldn’t), you can do the same on a per-source-file basis by right clicking on the source files you’re interested in debugging and setting the option in the properties for that source file. Just remember to clear those settings when you’re done (and don’t check them into source control) because the IDE doesn’t make it obvious that there are source file specific settings so it can be confusing down the road.

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

Sidebar

Related Questions

I've been encountering some strange behavior when trying to find a key inside a
I'm encountering this error while compiling some old VC++ 6.0 source code. error C2632:
I am encountering some odd behavior with Smarty but I believe solution is fairly
So I am seemingly encountering some strange behavior when using NSString 's -sizeWithFont family
This site was working properly before I started encountering an error after entering some
I am encountering some performance problems with my Entity Framework Code-First queries and I
I am encountering some weird behavior when calling a shell script from a Java
I am encountering some strange behavior with using the matplotlib.pyplot ginput() function to store
I'm encountering some peculiarities with LINQ to SQL. With a relatively simple query, I
I am creating reports using the Microsoft ReportViewer control. I am encountering some formatting

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.