If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Honestly, you shouldn't be making these type of beginner mistakes or at least, not be able to identify this mistake if you debugged your code.

I'll make it easy for you -- if you're ever doing a "<=" for the ending of a loop, look at your loop again and what you're looping over (a container, a string, etc.). Chances are, the <= is not correct, and you're going 1 more than it should (but again, this should have been obvious to you without our help).

Second, when you do make these mistakes, there is no guarantee how your application will run. That's the nature of C++.

Re: [RESOLVED] errors about types

Honestly, you shouldn't be making these type of beginner mistakes or at least, not be able to identify this mistake if you debugged your code.

I'll make it easy for you -- if you're ever doing a "<=" for the ending of a loop, look at your loop again and what you're looping over (a container, a string, etc.). Chances are, the <= is not correct, and you're going 1 more than it should (but again, this should have been obvious to you without our help).

Second, when you do make these mistakes, there is no guarantee how your application will run. That's the nature of C++.

Regards,

Paul McKenzie

thanks for correct me.
"Second, when you do make these mistakes, there is no guarantee how your application will run. That's the nature of C++."
so that's why sometimes worked and others don't, right?

Re: [RESOLVED] errors about types

You had a buffer overrun error where your code was overwriting other data in memory it shouldn't have been. c++ provides no check for this. In this circumstance whether the program 'works' or not depends upon the luck of the draw, what happens to be in memory at the time, the phase of the moon, the state of the tide..... It might work a few times then fail, it might work until a re-boot. It might always work on your computer but fail on another...

These type of errors are a nightmare to trace as they are not always repeatable and adding debug code can sometimes seem to 'cure' the problem but is only making the problem move about to resurface somewhere else. Trying to debug a program that 'occasionally fails' is the stuff of nightmares - so when dealing with memory be extra careful and vigulent about how you are dealing with it.

All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Re: [RESOLVED] errors about types

Originally Posted by 2kaud

You had a buffer overrun error where your code was overwriting other data in memory it shouldn't have been. c++ provides no check for this. In this circumstance whether the program 'works' or not depends upon the luck of the draw, what happens to be in memory at the time, the phase of the moon, the state of the tide..... It might work a few times then fail, it might work until a re-boot. It might always work on your computer but fail on another...

These type of errors are a nightmare to trace as they are not always repeatable and adding debug code can sometimes seem to 'cure' the problem but is only making the problem move about to resurface somewhere else. Trying to debug a program that 'occasionally fails' is the stuff of nightmares - so when dealing with memory be extra careful and vigulent about how you are dealing with it.

Re: [RESOLVED] errors about types

As you are setting/resetting blBlink in one thread and testing in another,

Code:

bool blBlink=true;

should be

Code:

volatile bool blBlink=true;

which is a hint to the compiler that blBlink may be changed without the compiler being aware of the fact so don't keep its value in a register, load its value every time from its actual memory location.

All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Re: [RESOLVED] errors about types

Originally Posted by 2kaud

As you are setting/resetting blBlink in one thread and testing in another,

Code:

bool blBlink=true;

should be

Code:

volatile bool blBlink=true;

which is a hint to the compiler that blBlink may be changed without the compiler being aware of the fact so don't keep its value in a register, load its value every time from its actual memory location.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.