hartmannathan commented on pull request #904: URL: https://github.com/apache/incubator-nuttx-apps/pull/904#issuecomment-981770040
> > Are we sure we want to remove the typecast from the (void *) returned by malloc() to (FAR struct dhcpc_state_s *) in this call: > > ``` > > -pdhcpc = (FAR struct dhcpc_state_s *)malloc(sizeof(struct dhcpc_state_s)); > > +pdhcpc = malloc(sizeof(struct dhcpc_state_s) + maclen - 1); > > ``` > > It's a normal practice to let compiler auto convert void * to type * in C: https://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc > > > Some compilers may warn about that. > > This implicit conversion is allowed by C standard. But, it forbid by C++. Ah yes, that's what it is. In my own work I code C so it builds as both C and C++, so I forgot that's a C++ warning. Here I guess it's okay since we are coding for C89. Thanks! -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
