Solved

TC's nuts

Posted on 1998-10-20
8
231 Views
Last Modified: 2010-04-15
Recently I programmed codes with turbo c++ 3.0,but something
happened very strange,the sequence in some place may reverse and,it can go into the statement coercively although
the condition isn't reached.
help me
0
Comment
Question by:cjun
8 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1253704
could you be a little more specific?
0
 

Author Comment

by:cjun
ID: 1253705
The codes included one main file and one procedure set file,error often occurs in the latter.
Now I set an example :
  bool waitstatus(unsigned int status)
  if (condition1)
  {
    while(condition2)
     {
       statement1;
       if(condition3)
       {
        statement2;
       }    
      }
     }
    }
when matching condition2,it goes to condition3 judging,although it doesn't match condition3,it still steps into statement2.my lenghth of the code is total to 800 lines,and
I defined more than 30 char * varieble in it.Of course,some strange phenomenas occur
in even static char *.Why?
0
 
LVL 3

Expert Comment

by:NullTerminator
ID: 1253706
You need to post a sample of the code that shows the behavior.  Your sample is to vague to judge.

You mentioned many char * variables.  Are they all pointing to valid space.  Are you overrunning the bounds of the character arrays?

'\0'
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 84

Expert Comment

by:ozo
ID: 1253707
How do you know it doesn't match condition3?
How do you know it steps into statement2?
0
 
LVL 1

Expert Comment

by:Bonev
ID: 1253708
Try to build it with all optimizations disabled.

0
 
LVL 1

Expert Comment

by:prozak
ID: 1253709
Are you using "=" instead of "=="?
0
 
LVL 10

Accepted Solution

by:
rbr earned 200 total points
ID: 1253710
Pls give more info about your code!
0
 

Author Comment

by:cjun
ID: 1253711
I now can I'd handled this bug.Because I'd a bad custom that always move string point
and never recover it,so I think it's the problem.for example:
/*the wrong way*/
char *test,*des;
 test=test+9;
 strcpy(des,test);


--------------
/*the right way is:*/

char *test,*des;
test=(char *)malloc(4000);
des=(char *)malloc(3000);
strcpy(des,test+9);

---and it's the right action,be careful when you use string point.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Programming Arduino to control a Max7219 using C 2 142
Line meaning 9 88
Super Scope, DHCP 5 91
Secondary drive is failing... D Volume 11 17
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question