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?
>
> Hadn't thought about that before... Is it possibly to reliably
> detect GCC? I heard about non-gcc compilers that #define
> __GCC__ to make more code compile.

ITYM mean __GNUC__.  If other compilers define that and don't
implement the same feature set then they deserve to break. :)

Something like this would default to label-pointers for gcc but
still allow it to be overridden for platforms that define
__GNUC__ but don't implement label-pointers:

#if defined(LC_INCLUDE)
# include LC_INCLUDE
#else
# if defined(__GNUC__)
#  include "lc-addrlabels.h"
# else
#  include "lc-switch.h"
# endif
#endif

But, it's not a big deal to have to specify that you want to
use label-pointers in the Makefile.

-- 
Grant Edwards                   grante             Yow! I'm receiving a coded
                                  at               message from EUBIE BLAKE!!
                               visi.com            


Reply via email to