[Tinyos-help] Very strange problem!

daniel widyanto danielw at wireless-people.com
Sun Feb 10 19:04:49 PST 2008


If I'm not mistaken the type's definition (int, long int, etc) in NesC
is following the AVR-GCC standard. Thus, AVR-GCC refers to GCC standards
(long int = 8 bytes, int = 4 bytes). 

That's why it's suggested to use uint8_t, uint16_t, etc. 

Please correct me if I'm wrong.

-daniel

On Sun, 2008-02-10 at 18:15 -0700, Michael Schippling wrote:
> sorry I wasn't following along in the book...so I'm lost.
> 
> But I wonder if using a long in the for() comparison is a problem.
> Since you don't even have an int's worth of memory to iterate
> through, you don't need range to be long. Might be worth a try,
> or at least a poke into the assembler output.
> 
> MS
> 
> Aurélien Francillon wrote:
> > 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