There is no difference between the manners.
Particularly in you example, the difference is that in the first call in
case of SUCCESS rest of the code will NOT be executed, since SUCCESS == 0.
In the second call, rest of the code WILL be executed.
If you want them to be the same you should write like this:

if((call Sender.generateConfig(0,(call Timer.getNow())/4,&pCDM,&sndcon)) ==
SUCCESS)
   //rest of the soce

Arik


On Tue, Dec 15, 2009 at 23:45, wafa jaballah <[email protected]>wrote:

> Hi ,
>
> I'm working with tinyos2.1. I have found two types of  writing a call
> to a command.
> For example,  the command prototype is:
>
>  command error_t Sender.generateConfig(uint8_t lvl, long  snd_time,
>       DATA_Packet_t *packet,Sender_Config_t *p )
>
>
> To call this command, I found two manners:
> the first manner is:
>
>
> 1) if((call Sender.generateConfig(0,(call
> Timer.getNow())/4,&pCDM,&sndcon)))
>
>    {
>
>       // rest of code
>
>
>    }
> 2 ) the second manner to call this command is:
>               error_t er;
>                er = call Sender.generateConfig(0,(call
> Timer.getNow())/4,&pCDM,&sndcon)
>                 if (er == SUCCESS)
>                     {
>
>                     // rest of code
>
>                   }
>
> I have found the two manners of writing a call to a command. Is there
> a difference between them? Is the first one  correct?
>
> Thanks,
>
> --
> Wafa Ben Jaballah
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



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

Reply via email to