On Friday 14 June 2013 17:31:37 Sascha Hevelke wrote:
> Hi everyone,
> 
> I am currently working on an implementation of a simple interface. My
> code looks as following:
> 
> 
> module CorrectionMessageC {
> 
>      provides interface CorrectionValueInterface;
> }
> implementation {
> 
>      command void
> CorrectionValueInterface.generateOutlierMessage(uint16_t xVals[],
> uint16_t* yVals[], uint16_t valC) {
> 
>          uint8_t dataLength = 16;
>          uint16_t countVals = 2*valC;
>          uint16_t arraySize =countVals * dataLength / 7;;
> 
>          uint16_t currIndex = 0;
>          uint8_t message[arraySize];
>      }
> }
> 
> Until here everything is fine, it compiles without errors. Now if i
> alter the code and add e.g. an if statement like so:
> 
> 
> command void CorrectionValueInterface.generateOutlierMessage(uint16_t
> xVals[], uint16_t yVals[], uint16_t valC) {
> 
> 
>          uint8_t dataLength = 16;
>          uint16_t countVals = 2*valC;
>          uint16_t arraySize =countVals * dataLength / 7;
> 
>          if (1==1) {
>          }
> 
>          uint16_t currIndex = 0;
>          uint8_t message[arraySize];
> }

You need to have your variable declarations before the actual code.

> the compiler says 'CorrectionMessageC.nc:18: syntax error before
> `currIndex''. I don't see what is wrong here, am I overseeing something
> here?
> 
> Thanks in advance
> 
> P.S.: I'm using tinyos 2.1.0 and telosb motes if that makes a difference
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to