3 ms·
On some microcontrollers I know a pointer to address 0 really is just that. I tested compiling the following unsigned short *a = 0; ((void (*)(void))a)
by sdk77 10y ago
On some microcontrollers I know a pointer to address 0 really is just that. I tested compiling the following
unsigned short *a = 0;
((void (*)(void))a)();
which may cause a jump to address 0 (usually the reset vector).
On R8C with the NC30 compiler there are no warnings and the output is:
MOV.W:Q #0H, -2H[FB]
MOV.W:G -2H[FB], R0
MOV.W:Q #0H, R2
JSRI.A R2R0
It jumps to 0. But on PIC 16 with the XC compiler a warning is emitted warning: (1471) indirect function call via a NULL pointer ignored and the statement is not compiled at all.