if (var != nullptr) VS if (nullptr != var)

If it's not ZDoom, it goes here.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: if (var != nullptr) VS if (nullptr != var)

Post by Graf Zahl »

This is all a bit tricky. I had to adjust to randi's style as well. My personal preference for pointers is either "if (ptr)" or "if (!ptr)" but that wasn't how most of ZDoom was written, its dominant form has been "if (ptr == nullptr)".

Yes, curly braces, comment style and tabs are indeed more important, although modern auto-formatting editors can make this a bit hard to obey. Visual Studio doesn't play nicely with PrBoom's source formatting, for example.
Post Reply

Return to “Off-Topic”