On 2007-11-14, Adam Dunkels <[email protected]> wrote:

>> I see that the gcc "pointers to labels" implementation is what
>> is used by default (which removes the restriction on using
>> switch() statements in a protothread).
>
> I think it actually defaults to the switch()-based
> implementation.

You're right.  I misread the conditional in the include file.

Defining LC_INCLUDE to be "lc-addrlabels.h" will use the
label-pointer version.  Have you thought about that being the
default when gcc is used?

> If you are using gcc, the label-pointer implementation is
> better as it doesn't inhibit switches. It is also slightly
> faster (at least on the MSP430).

>> Yup.  That'll take a little getting used to, but hopefully gcc
>> will warn me if I forget.  In practice very, very few of the
>> tasks I write ever need to be re-entrant, so static locals for
>> persistent stuff are are fine.
>
> Yes, gcc with a -O option warns that the variables "might be
> used uninitialized in this function". Running with -Werror
> should make this even more visible.

I always use -Werror.  Sometimes I have to hack on the compiler
to inhibit a useless warning, but I'd rather do that than ship
code that won't compile without warnings.

-- 
Grant Edwards                   grante             Yow! MERYL STREEP is my
                                  at               obstetrician!
                               visi.com            


Reply via email to