Skip to content

Commit 2102420

Browse files
authored
Fix: Corrected function pointer prototype and build issues (#607)
- Fixed a type compatibility issue when assigning the function pointer, resolving build errors. - Added typedef `func_ptr_t` to properly define the function pointer type. - Replaced explicit cast with the typedef for better readability and maintainability.
1 parent abcd62a commit 2102420

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

multicore/multicore_runner/multicore_runner.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212

1313
#define FLAG_VALUE 123
1414

15+
typedef int32_t (*func_ptr_t)(int32_t);
16+
1517
void core1_entry() {
1618
while (1) {
1719
// Function pointer is passed to us via the FIFO
1820
// We have one incoming int32_t as a parameter, and will provide an
1921
// int32_t return value by simply pushing it back on the FIFO
2022
// which also indicates the result is ready.
21-
int32_t (*func)() = (int32_t(*)()) multicore_fifo_pop_blocking();
23+
func_ptr_t func = (func_ptr_t) multicore_fifo_pop_blocking();
2224
int32_t p = multicore_fifo_pop_blocking();
23-
int32_t result = (*func)(p);
25+
int32_t result = func(p);
2426
multicore_fifo_push_blocking(result);
2527
}
2628
}

0 commit comments

Comments
 (0)