[Tinyos-help] Bug in NesC or a simple error.........???

Philip Levis pal at cs.stanford.edu
Fri Jan 26 08:55:37 PST 2007


On Jan 26, 2007, at 4:36 AM, Miguel Pereira wrote:

> Hi,
>
> I already figure out what is the problem but there is something  
> wrong with nesC compiler.
> The problem is the number 65535. When I put this number in one  
> variable uint16_t, one warning fire, which is comprehensible  
> because besides I'm using the uint16_t the range could be of -32767  
> to 32767. If I put the number 32767, all OK, but if I put 32768 all  
> became wrong again. To resolve the problem I thing in use the  
> uint32_t type but happens exactly the same.
> If I put uint32_t number = 32767 there is no problem but if I put  
> uint32_t number = 32768 the warning "decimal constant is so large  
> that it is unsigned" fire and I think this shouldn't happen.
>

Unspecified constants revert to signed integers; in microcontrollers,  
an int is usually 16, not 32 bits.

Phil


More information about the Tinyos-help mailing list