strange behaviour of code.....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bajajv
    New Member
    • Jun 2007
    • 152

    strange behaviour of code.....

    Hi, I am using Borland C++ Builder 5.0. We have a working code, but when we try to make some changes in it, it starts giving error. This happens in one file only. If change is in any other file, it runs smooth. The code doesn't uses any such file or library at runtime which can make effect in this manner.
    Even if we add -- int i = 0; --- in a function which is not called until we select some option from the GUI, the code's flow is disrupted even before the GUI is generated. Every time the problem is at function where form is being created.
    Any guess what could be the reason?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    You are invoking undefined behaviour in some way. I would guess most probably that somewhere in you ode you are writing to an unitialised pointer or writing outside the bounds of an array.

    Comment

    • bajajv
      New Member
      • Jun 2007
      • 152

      #3
      @Banfa
      No Sir, I checked it out, but it is nothing like that. You add just one line in any function in a particular file, and the code doesn't run properly.
      Even int i; doesn't let it work.

      Comment

      • bajajv
        New Member
        • Jun 2007
        • 152

        #4
        It is giving invalid scope at some point, and is not going on a sprintf loc.

        Comment

        • bajajv
          New Member
          • Jun 2007
          • 152

          #5
          sorry, its not invalid scope, it is inactive scope. And it comes at a for loop,
          for(n = 0; n <= (int)Plot->PlotNo; n++)
          {
          sprintf(temps, "%d", n + 1);
          PlotBox->Items->Add(temps);
          }

          The control doesn't goes to the sprintf line and gives inactive scope there.

          Comment

          Working...