Just as
ISR(USART_RXC_vect)
is not literally just
USART_INTERUPT_VECTOR:
in Assembler,
return;
is not literally just
ret
or
reti
in Assembler.
Both instructions in C/C++ will be translated into multiple Assembler statements and in both cases it will depend on context. The context for an ISR(){}
is quite one-track in this case, but it will most likely also include a few pushes and storing the SREG. But the number of pushes to the stack will depend on what happens in the function.
So will any return;
be interpreted in context. At the end of a normal subroutine that actually gets built into a subroutine (many subroutines of limited use get "in-lined" by a compiler for code efficiency reasons) it will become a ret
instruction (after handling any needed POPs and other low-level clean-up). At the end of an interrupt it will actually mean "pop everything you pushed before (and also restore the SREG) and then reti
".
When you return a type that will get compiled into transferring that value through the platform's system, before including the ret
instruction. So return;
is a very context sensitive statement that you can assume will be interpreted correctly, unless you do very weird things. But those weird things will be things a good compiler (like AVR-GCC) will at the least warn for.