xiaoxiang781216 edited a comment on issue #740: URL: https://github.com/apache/incubator-nuttx/issues/740#issuecomment-672867706
> > But don't use type void *. There are problems using type void * with certain architctures (AVR I think) that was fixed by created wdparm_t. Please continue to use wdparm_t. > > The argument was originally a uint32_t. I was changed to a union with commit [b8f3bd8](https://github.com/apache/incubator-nuttx/commit/b8f3bd857be74ff78e01d961afbaedfbf17814ed) because there are many architectures where sizeof(void *) < sizeof(uint32_t), MCS51, ez80, etc. So void * is insufficient for passing a uint32_t. > Yes, `sizeof(void *)` may small than `sizeof(uint32_t)`, but I am wondering that is it possible that `sizeof(FAR void*) < sizeof(uint32_t)`. > This was changed again to the current wdparm_t form with commit [3adcae8](https://github.com/apache/incubator-nuttx/commit/3adcae8ffbf247f1038bbb3b8281ea811799031e) because there were issues in passing a union with certain compilers (SDCC at the time). > > So, please don't consider using void * instead of wdparm_t. You will definitely break things! And if `FAR void *` will break things, there are many basic components will break too, e.g.: ``` /* This struct defines the form of an interrupt service routine */ typedef CODE int (*xcpt_t)(int irq, FAR void *context, FAR void *arg); /* Defines the work callback */ typedef CODE void (*worker_t)(FAR void *arg); #ifndef __PTHREAD_ADDR_T_DEFINED typedef FAR void *pthread_addr_t; #define __PTHREAD_ADDR_T_DEFINED 1 #endif typedef CODE pthread_addr_t (*pthread_startroutine_t)(pthread_addr_t); typedef pthread_startroutine_t pthread_func_t; /* Non-standard convenience definition of signal handling function types. * These should be used only internally within the NuttX signal logic. */ typedef CODE void (*_sa_handler_t)(int signo); typedef CODE void (*_sa_sigaction_t)(int signo, FAR siginfo_t *siginfo, FAR void *context); int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg); /* thrd_start_t: function pointer type passed to thrd_create */ typedef CODE int (*thrd_start_t)(FAR void *arg); /* tss_dtor_t: function pointer type used for TSS destructor */ typedef CODE void (*tss_dtor_t)(FAR void *); ``` I don't think without irq/work especially irq, the system can work as expect. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
