4 ms·
> the penalties associated with RAII and .... there are 0 penalties associated with RAII. struct my_interrupt { my_interrupt() { vendor_specific_hor
by jcelerier 9y ago
> the penalties associated with RAII and
.... there are 0 penalties associated with RAII.
struct my_interrupt {
my_interrupt() { vendor_specific_horrible_stuff(0x237ABC); }
~my_interrupt() { if(whatever) vendor_specific_horrible_stuff(0x237BAC); }
};
void f() {
my_interrupt is_enabled;
// do stuff
}
will translate to exactly the same assembly than
void f() {
vendor_specific_horrible_stuff(0x237ABC);
// do stuff
if(whatever) vendor_specific_horrible_stuff(0x237BAC);
}