You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/08/11 19:31:57 UTC

[GitHub] [incubator-nuttx] patacongo edited a comment on issue #740: problem with nxsig_timeout (sig_timedwait.c)

patacongo edited a comment on issue #740:
URL: https://github.com/apache/incubator-nuttx/issues/740#issuecomment-672212866


   The inefficiency in the proposal should be considered as well.  You once told me that all calls to wd_start() but one provided only a single parameter.  it sems wasteful to set up a structure containing that one parameter and passing it to to wd_start().
   
   What is the size argument?  There can be no more than CONFIG_WDOG_MAXPARMS arguments and each must be size wdparm_t.  A size_t is used to hold the largest possible memory object (in bytes).  A count of arguments makes more since and should be just an int.
   
   So If I wanted to pass one argument I would have to do:
   
       wdparm_t wdarg = (wdparm_t)arg;
       ret = wd_start(&wdog, delay, entry, sizeof(wdarg), &wdarg);
   
   arg would have to copied to a wdparm_t variable because sizeof(arg) may not be compatible with sizeof(wdparm_t) so you cannnot just pass a pointer to arg.
   
   Then wd_start() would have to divide size by sizeof(wdparm_t) to get the number of arguments?
   
   Versus my suggestion:
   
     ret = wd_start(&wdog, delay, entry, arg, 0);
   
   Since we are passing by value, not reference, arg will be automatically converted to type wdparm_t.
   
   Which looks less "ugly" to you.  (We should not be using ugliness as a value for making engineering decisions unless all other things are equal.  I think we say ugly because we can't verbal the reasons for preferring one thing over an another.)


----------------------------------------------------------------
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:
users@infra.apache.org