Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> In spite of nullptr existing now, NULL is still (quite stupidly) not required to just expand to nullptr, but to an implementation-defined null pointer constant, rather than #define NULL nullptr. (According to the N2596 draft).

This is so silly. I sort of get why not (can't break the dork that decided to do

    int i = NULL;
    i++;
)

But, at the same time... I almost feel like this is a "you are being a dork, go fix your code." moment. This isn't the sort of break where someone would see it and go "Oh yeah, assuming NULL is anything other than nullptr is dumb!"



> can't break the dork that decided to

Why not? We've broken the dork who used undeclared functions, void main, gets ...

(It's the same funking dork anyway. You know who you are, I'm looking at you!)

Note that

  int x = ((void *) 0);
will actually work in GCC and get you a zero into x, just with a conversion warning. The dork is unaffected; their code works and they don't read warnings.


See https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html for why this might not be the case anymore soon - although I suppose that adding in -fpermissive or -Wno-error=conversion or something like that isn't too much effort.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: