Using / accessing function pointer declaration externally
-
OK, this is really simple question, with example code to boot. The function pointer declaration is this void (*gpf_isr)(void) = (0UL); It is used by this function void UOTGHS_Handler( void ) { if (gpf_isr) gpf_isr(); } and I access it like so extern void (*gpf_isr)(void); then I assign my local poiter / version of the function gpf_isr = ( object ) . UTOGHS_Handler; The silly question why this also get pass the compiler , no errors extern void (*gpf_isr)(void) = (0UL); The pointer gets reassigned , but ...
-
OK, this is really simple question, with example code to boot. The function pointer declaration is this void (*gpf_isr)(void) = (0UL); It is used by this function void UOTGHS_Handler( void ) { if (gpf_isr) gpf_isr(); } and I access it like so extern void (*gpf_isr)(void); then I assign my local poiter / version of the function gpf_isr = ( object ) . UTOGHS_Handler; The silly question why this also get pass the compiler , no errors extern void (*gpf_isr)(void) = (0UL); The pointer gets reassigned , but ...
-
OK, this is really simple question, with example code to boot. The function pointer declaration is this void (*gpf_isr)(void) = (0UL); It is used by this function void UOTGHS_Handler( void ) { if (gpf_isr) gpf_isr(); } and I access it like so extern void (*gpf_isr)(void); then I assign my local poiter / version of the function gpf_isr = ( object ) . UTOGHS_Handler; The silly question why this also get pass the compiler , no errors extern void (*gpf_isr)(void) = (0UL); The pointer gets reassigned , but ...
-
See, for instance How to define extern variable along with declaration?[^]
-
That is pretty clear that defining the variable is OK, but if optioned GCC will give a warning. Kind like deleting a file and being ask "are you sure?" Thanks .