[Tinyos Core WG] Re: Adding fields to structs
Kevin Klues
klueska at gmail.com
Fri Apr 6 19:21:49 PDT 2007
By the lack of response to this email I can conclude that either (a)
this feature is not something that people think would prove very
useful (I disagree) (b) adding this feature seems complicated and not
worth the effort of implementing anytime in the near future (c) people
think the feature might be useful, it wouldn't be that hard to
implement, but no one has time to take a serious look at how to go
about it.
Which conclusion is the most accurate?
Kevin
On 4/5/07, Kevin Klues <klueska at gmail.com> wrote:
> At the end of the meeting today (after David Gay left) we were
> discussing if it would be possible to get nesc support for allowing
> additional fields to be tacked on to the end of struct.
>
> Such functionality would be useful in many different circumstances.
> For the implementation of the cc2420 radio stack it could be used to
> add additional fields based on the different layers that are added to
> the stack. It would also be useful for adding protocol specific
> fields to a row in a neighbor table based solely on which components
> have been included.
>
> Potential syntax might be something like the following:
>
> typedef struct my_struct {
> uint8_t my_field0;
> uint8_t my_field1;
> } my_struct_t;
>
> extend struct my_struct_t {
> uint8_t field2;
> };
>
> The primary advantage of this approach is that these extensions can
> appear in places other than the original definition of the struct.
> For example, the inclusion of the LinkLayerRetransmission layer for
> the cc2420 stack could be accomplished by simply including a nesC
> component in which the extended struct is declared (possibly in a
> header file), rather than using the current approach where a
> preprocessor variable needs to be defined and #ifdefs need to appear
> throughout the definition of the cc2420_metadata_t struct in CC2420.h.
>
> Is this something that could easily be added? Is this something
> people would find useful in other situations as well?
>
> --
> ~Kevin
>
--
~Kevin
More information about the Tinyos-2.0wg
mailing list