mardi 20 mars 2018

Why 0 is used as nullpointer in compiler headers?

When I compile my code with -Wzero-as-null-pointer-constant flag i get warning like this:

/usr/arm-none-eabi/include/c++/7.3.0/ext/new_allocator.h:99:45: warning: zero as null pointer constant 

pointing to :

      pointer
      allocate(size_type __n, const void* = static_cast<const void*>(0))
      {

I use c++11 or newer. Why compiler headers are written on way that rise warnings? Is static_cast<const void*>(0) any better than nullptr in this usage?

Aucun commentaire:

Enregistrer un commentaire