M
Myth__Buster
#include <stdio.h>
struct InterruptData
{
int numberOfInterrupts;
volatile int timer;
int numberOfTimesInterruptsMasked;
} InterruptMonitor;
/*
* Interrupt handler code.
*/
int main(void)
{
InterruptMonitor = InterruptMonitor;
printf("\n LOG - InterruptMonitor.numberOfInterrupts : %d \n",
InterruptMonitor.numberOfInterrupts);
printf("\n LOG - InterruptMonitor.timer : %d \n",
InterruptMonitor.timer);
printf("\n LOG - InterruptMonitor.numberOfTimesInterruptsMasked : %d \n",
InterruptMonitor.numberOfTimesInterruptsMasked);
return 0;
}
-------------
InterruptMonitor = InterruptMonitor; - Should this be a candidate for compile-time optimization in spite of having a field qualified as volatile?
Cheers,
Raghavan Santhanam
struct InterruptData
{
int numberOfInterrupts;
volatile int timer;
int numberOfTimesInterruptsMasked;
} InterruptMonitor;
/*
* Interrupt handler code.
*/
int main(void)
{
InterruptMonitor = InterruptMonitor;
printf("\n LOG - InterruptMonitor.numberOfInterrupts : %d \n",
InterruptMonitor.numberOfInterrupts);
printf("\n LOG - InterruptMonitor.timer : %d \n",
InterruptMonitor.timer);
printf("\n LOG - InterruptMonitor.numberOfTimesInterruptsMasked : %d \n",
InterruptMonitor.numberOfTimesInterruptsMasked);
return 0;
}
-------------
InterruptMonitor = InterruptMonitor; - Should this be a candidate for compile-time optimization in spite of having a field qualified as volatile?
Cheers,
Raghavan Santhanam