[Tinyos-help] Very strange problem!
Aurélien Francillon
aurelien.francillon at inrialpes.fr
Sun Feb 10 15:26:45 PST 2008
AIGroup a écrit :
> I'm using only one sample to prevent too much computational cost.
> I yet have the problem and today I have seen that most of these errors
> is caused by automatic cast. If the cast is forced, most of this events
> don't occur.
> I hope to find a solution very soon!
> Thanks for your time
>> long compute_index(long int *binfeature, long int range, long int
>*index)
>> {
>> int i=0,ii=0;
>> /*THE PROBLEM IS HERE: IF I PUT A NUMBER (e.g. 2) INSTEAD OF
>range THE
>> STATEMENT for WORKS WELL */
>> for(i=0;i<range;i++) /* <----T
>> {
>> if(binfeature[i])
>> {
>> index[ii]=i;
>> ii++;
etc...
...
hum to my opinon you should check here and in other places that you
don't overflow the array called "index" i.e. it depends on too much
magic to work reliably...
as a starter adding a manual check for "ii" to be in range of your array
might help?
Overflowing the array could very well lead to various kind of unreliable
and unexplicable behaviour as you may overwrite stack or other variables ...
cheers
Aurelien
More information about the Tinyos-help
mailing list