Menu

Add a new style check for nullptr

2021-12-25
2021-12-29
  • Frederick Gotham

    I think that we should check through code for:

    int *p = 0;
    int *p = NULL;
    

    and flag it for style because it should really be:

    int *p = nullptr;
    
     
  • Frederick Gotham

    I just found out today that the following command-line option can be used with g++ to forbid the use of anything other than nullptr:
    -Werror=zero-as-null-pointer-constant

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.