## 3.9.1 Critical Functions and Critical Statements

A special keyword may be associated with a block or a function declaring it as __critical. SDCC will generate code to disable all interrupts upon entry to a critical function and restore the interrupt enable to the previous state before returning (for architectures where there is no efficient way to do so (sm83, tlcs90, stm8), interrupts will be unconditionally enabled instead). Nesting critical functions will need one additional byte on the stack for each call.

> int foo () __critical
> {
> ...
> ...
> }

The critical attribute maybe used with other attributes like reentrant.
The keyword __critical may also be used to disable interrupts more locally:

> __critical{ i++; }

More than one statement could have been included in the block.