[Tinyos-help] C struct questions in TinyOS

David Gay dgay42 at gmail.com
Thu Aug 2 09:56:48 PDT 2007


On 8/2/07, Michael Schippling <schip at santafe.edu> wrote:
> You are right about
>      typedef struct { int16_t var; } MateValueVariable;
> being functionally equivalent to
>      typedef int16_t MateValueVariable;
>
> However the usage would be a bit different.
> For the first you would do:
>      MateValueVariable x;
>      x.val = NNN;
> and the second:
>      MateValueVariable x;
>      x = NNN;
>
> Since there are two examples of seeming redundancy, and they have
> the same member name "val", someone may be trying to imitate Object
> Disoriented overloading or something.

I think the words you're looking for are "encapsulation", and "good
software engineering" ;-)

David Gay


More information about the Tinyos-help mailing list