[Tinyos-host-mote-wg] Re: [Tinyos-2.0wg] recommendation for coding convention on state variables

David Gay dgay42 at gmail.com
Thu Oct 13 10:30:26 PDT 2005


FWIW, I think we shouldn't gratuitously use gcc'isms in portable code.
However, a platform can decide it's gcc-specific (or not).

In your list below, I see different kinds of problems:
- gcc'isms in tinyos code
- gcc'isms/unix'isms in the code generated by nesC. Fixable by adding
support for other compilers to nesC (note that this also requires
somebody to rewrite a toolchain around nesc1 - strangely, nobody ever
volunteers to do this part...)
- Code Composer not supporting standard ANSI C features
- Code Composer not supporting C99 features (it is 2005, after all ;-))

On 10/13/05, Joe Polastre <joe at polastre.com> wrote:
> Oh, and just so you know, these are the changes that had to be made
> for Code Composer, and even after this we still had to hand-tweak the
> app.c to get it to compile in CC:
>
> _asm doesn't work for Code Composer.   Affects all TOSH_*_PIN()
> macros.  Use CC asm instead.

That's a platform decision.

> remove all lines starting with #

unix'ism in nesC output. I thought most compilers supported this one, though...

> long long is non standard (change to just 'long')

In C99.

> remove all register definitions

?? "register" has been in C since forever and before, AFAIK. Or do you
mean something else? (if the telos h/w registers, that's clearly a
platform decision - and it's probably a bad idea to use header files
intended for gcc w/ some other compiler...)

> replace all '__atributed ((packed))'

gcc'ism in TinyOS code

> remove debug enums
>
> change all enums to #define

Code Composer doesn't support enum??? That one's been common since
pre-ANSI C days... Though with the issues with static and volatile
below, maybe I shouldn't be surprised...

> replace all $ with ___

gcc'ism in the nesC generated code.

> remove all 'static' keywords

Ick. Strange compiler.

> remove all 'inline' keywords

In C99.

> remove 'volatile' keywords

Ick. Very strange compiler. How do you get anything to work with
interrupt handlers? Or doesn't it do any storage optimisations?

>From this list, I'd say that gcc'isms in the tinyos code are not
exactly the major problem...

David

_______________________________________________
Tinyos-2.0wg mailing list
Tinyos-2.0wg at Mail.Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-2.0wg


More information about the Tinyos-host-mote-wg mailing list