patacongo commented on issue #740: URL: https://github.com/apache/incubator-nuttx/issues/740#issuecomment-672195129
> The minimum essential changes for the portability are included in the PR, but > if possible, I think that the API spec of wd_start() should be changed. > Because the current spec is likely to misuse which breaks the portability. > > My proposal is, to change the API to: > ` int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, size_t size, wdparm_t arg);` > > And change the typedef of wdentry_t to: > `typedef CODE void (*wdentry_t)(wdparm_t arg);` > > Instead of passing the variable arguments, pass the pointer to struct and its size > to wd_start() for multiple arguments. What controls the "life" of structure pointed to by "arg". It cannot be in a stack and it can become stale if it is in allocated memory. In general, it cannot be a static variable either. If allocated, what frees the structure. Because of these complexities, I think this is a bad idea. Let's not do this. I vote -1. Why not just: int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, size_t size,wdparm_t arg1, wdparm_t arg2);` typedef CODE void (*wdentry_t)(wdparm_t arg1, wdparm_t arg2);` Since those are passed directly be value rather then through a container structure, the interface is simplified and there is no concern for management of the life of an allocated structure. ---------------------------------------------------------------- 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: us...@infra.apache.org