Hi Fatima,

If the structure Attribute is only used internally (ie. not directly 
sent over the radio), then you can just leave it as it is. If the 
compiler issues warnings or errors, you can simply remove the 
"__attribute__ ((packet))" part. Anyways, for this specific code I think 
any 8- and 16-bit compiler would generate the same code, whether the 
packed attribute is specified or not.

If the Attribute structure is part of a radio message I recommend that 
you use the nx_ data types.

My pragmatic view is: if this is not your code and it works, why change it?

Cheers,
Urs


fatima zohra wrote:
> 2008/4/14 Urs Hunkeler <[EMAIL PROTECTED]>:
> 
>> Hi Fatima,
>>
>> I think it's mainly a question of style. Often something starts as a
>> simple test, and then all of a sudden the code is in some production release
>> and everybody has forgotten about the little hack for testing purposes.
>>
>> Then again, why would you need the packet attribute anyways? The only
>> reason I see for using the packet attribute (on TinyOS 1.x) is to actually
>> ensure that all platforms put the data bytes at the same offset when
>> transmitting data. So if you only use one platform (simulation), then the
>> packed attribute is not necessary, and if you use multiple platforms
>> (testing on real hardware) you should not use it :-)
>>
>> Cheers,
>> Urs
>>
>> Hello,
> i am still having small confusion about the way we can define an attribute.
> Once the packed attribute shouldn't be used, can you tell me what is the
> best way to change this declaration:
> 
> #ifndef _ATTRIBUTE_H_
> #define _ATTRIBUTE_H_
> 
> typedef struct {
>   uint8_t  key;          // key
>   uint8_t  op;            // operator as defined in ..
>   uint16_t value;      // Value
> 
> } __attribute__ ((packed)) Attribute;
> 
> typedef Attribute *AttributePtr;
> 
> #endif
> 
> your help will be kindly appreciated.
> 

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

Reply via email to