https://github.com/rheit/zdoom/pull/639
Just some C++11 stuff
Replace NULL with nullptr
Moderator: GZDoom Developers
- The Zombie Killer
- Posts: 1528
- Joined: Thu Jul 14, 2011 12:06 am
- Location: Gold Coast, Queensland, Australia
-
-
- Posts: 3213
- Joined: Wed Nov 24, 2004 12:59 pm
- Operating System Version (Optional): Kubuntu
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Replace NULL with nullptr
I see absolutely no reason to make a sweeping change like this just because it can be done. Yes there are advantages to using nullptr going forwards, but it's not something that can't be slowly rolled out as code is touched.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Replace NULL with nullptr
Agreed. That's how I was handling it - when I'm touching code that has NULL's I am replacing them. Changing such stuff just because can later cause problems to find when things were changed.
I'd also like to replace ZDoom's homegrown sized integers with the official stdint.h types but only if there is some consensus that it is a good idea and also gradually.
I'd also like to replace ZDoom's homegrown sized integers with the official stdint.h types but only if there is some consensus that it is a good idea and also gradually.
Re: Replace NULL with nullptr
Sure it's a very good idea, especially for type names like DWORD or BYTE. And no more USE_WINDOWS_DWORD workaround.Graf Zahl wrote:I'd also like to replace ZDoom's homegrown sized integers with the official stdint.h types but only if there is some consensus that it is a good idea and also gradually.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Replace NULL with nullptr
Last time it got blocked because of the _t suffix. I'd still prefer the official types, though, than redefining them again for some questionable convenience. But of course this can only be done if everybody agrees and if it's done gradually, not all at once.
Re: Replace NULL with nullptr
As C++11 (or in fact C++14) compiler is now required, all supported build environment must have <cstdint> header. I doubt that redefining is really needed.
Or did you mean typedef's them without _t suffix? But in this case they may conflict with third party libraries or with platform specific types. You know that there is at least one system with a bunch on huge frameworks and with pretty much everything included in their header files.
Or did you mean typedef's them without _t suffix? But in this case they may conflict with third party libraries or with platform specific types. You know that there is at least one system with a bunch on huge frameworks and with pretty much everything included in their header files.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Replace NULL with nullptr
That's precisely why I'd prefer to use compiler-native types. They are most likely guaranteed not to conflict with anything, except for some badly behaved old libraries, which ZDoom does not use.
But the entire typedef madness that's going on is not something I consider ok.
I'd still prefer stdint.h, the C++ namespacing is something I'd rather avoid here.
But the entire typedef madness that's going on is not something I consider ok.
I'd still prefer stdint.h, the C++ namespacing is something I'd rather avoid here.