Replacement for AVR libc ATOMIC_BLOCK macros, now for DUE and other platforms.

Good find, I haven't really read about those functions myself.

But, no that wouldn't work, I don't think ATOMIC_BLOCK would either if you did a 'longjmp' in its scope.

I think this case is fairly well covered as the standard states it completely subverts stack unwinding, and requires 'setjmp' to be set, and is the clients explicit choice. If the user doesn't read documentation on longjmp and mistakes it for an asm jump for example, they have more to worry about than ISR safe code.

It also appears exception handling is the C++ way of "long distance transfer of flow control", which doesn't bypass the C++ stack unwinding semantics.

I'd imagine using it would be quite destructive to a C++ program on a micro controller.