C++ question. OVERRIDE macro purpose

Hello. I came from different language but I’ve read several C++ books and can program with it. But of course in such big project as UE4 things much more complicated than in books. So, my first question: there’s OVERRIDE macro in engine. Tutorial says

I put cursor on this word, pressed F12 and saw

it’s in WIndowsPlatform.h. Also I checked AndroidPlatform.h, MacPlatform.h - always the same. So why does this keyword replaced? How does it allows more portability?

I assume if they actually add additional functionality to it for a reason later on in UE4’s life then you won’t have to go back and change override to OVERRIDE everywhere. Just a guess though.

Couple of reasons why this might be the case:

  1. At the time they started developing the engine, the override decorator wasn’t supported on all the platforms / compilers they wanted to support. And now their macro is used everywhere throughout the code base it would be impractical to change it.

  2. The XboxOne and/or PS4 supported compilers may not support it. Since you don’t have access to those platforms you may not see the macro being empty.

  3. Additionally, any future platforms’ compilers may not support it, and so they use the macro for potential future compatibility.

We started using OVERRIDE before it was reliably supported all the compilers we cared about, so the macro was useful to avoid compilation problems in those cases. Nowadays that’s really not an issue and we use many other C++11 features regularly, but we’ve never gone back and updated it.