Hi,

> tested my code with CRITICAL macro. The macro works (tested that)
> but it did not solve my issue, but I'll make an other post about that.
>
> BTW there is a small typo in the macro you sketched, you cannot
> have a non const initializer for the static var, so I modified it as
> follows:
>
> #define CRITICAL(CODE) do { \
>    static unsigned char __sdcc_iflags; \
>    __sdcc_iflags = (INTCON & 0xC0);  \
>    INTCON &= ~0xC0; \
>    do { CODE; } while (0); \
>    INTCON |= __sdcc_iflags; \
> } while(0)
>
> Speaking of which __sdcc_iflags, why do you make it static? Local would
> do, wouldn't it or is it so that it will in any case end up using same
> amout of memory or performance point?

You are right, static is completely useless if not wrong here. I wanted
to avoid filling the global symbol namespace with __sdcc_flags, but
since the variable is not global, static completely misses the point.

> Do we need to protect the prologue/epilogue?

Not sure, probably not, though __critical attached to the function
probably would.

> PS A compiler warning for non implemented __critical would be nice....

Yepp, once I get to it ...

Best regards,
Raphael

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to