xiaoxiang781216 commented on pull request #5519:
URL: https://github.com/apache/incubator-nuttx/pull/5519#issuecomment-1045978970


   > I recognize that by having the various NULL checks, some compilers may 
issue warnings about impossible code paths, etc. 
   
   Yes, but this is just for some special functions(e.g. strcpy) which is known 
by compiler internally.
   
   > However I feel it is safer to have the NULL checks. One idea could be to 
make '-Werror=nonnull-compare' and '-Werror=format-truncation' dependent on 
(yet another) Kconfig and make the compiler warnings and the NULL pointer 
checks mutually exclusive. So either you have compiler warnings or NULL checks, 
but not both or neither. My 2 cents. :-)
   
   Kconfig means user can enable it, and then the compiler throw many warning. 
Here is my thought:
   
   1. Compiler will throw warning if caller pass NULL pointer to these special 
function
   2. NULL pointer access normally generate the hardware exception by MPU or MMU
   3. The affected functions are very small and simple
   
   So, the side effect is minor.


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to