What version of C++ is Unreal Engine 4 built on?

Hi,
I haven’t developed in C++ in years! I’ve been working in ActionScript3, JavaScript, Java, C# all these years…
All my pass knowledge is managed code with no need to worry about pointers and releasing memory…
I’ve heard that the new C++ (I think it’s version 11) it has something called smart pointers, that it’s like managed code… no need to release memory.
Am I getting it right? Is the new Engine works like that?

Any information about this subject would be great!

Thanks

It is C++ 11

Unreal has it’s own garbage collection.

The fact that it has garbage collection does not mean that that it is automatic.
At it’s core it is C++ and in C++ RAII (aka smart pointers) is not the default way the memory is managed unless you explicitly allocate memory as smart point i.e



/*C++11 code*/

#include <memory>

int main(){

    int * p = new int[10]; //memory leak
    
    std::shared_ptr<int> p1 = std::shared_ptr<int>(new int[10]); //no leak

   return 0;
}



So you cannot assume that there is automatic garbage collection in C++, unless you allocate it as a RAII object.

I wasn’t implying it is automatic. Just that they have their own smart pointer types.

We run the gamut of memory management options.

UObjects, our main reflection based class system, is garbage collected at a specified interval (typically 30 sec, but configurable)
**FWeakObjectPtr **is a pointer to a UObject that won’t affect garbage collection and will be NULL’d if it is in fact GC’d
TSharedPtr<> and TSharedRef<> are ref counted shared pointers as you’d expect them, and will free memory when all references are removed

  • TSharedRef<> is basically a TSharedPtr<> that cannot be NULL
    **TWeakPtr **works with TSharedPtr<> and doesn’t hold a ref count

Finally you have regular old pointers that you manage the memory lifetime itself. There is lots of documentation available and in the code on these class types. Hope this helps.

We are working on identifying and adopting the main C++11 extensions and you’ll already find many examples in the code base. We have to keep in mind many different compilers, so we have typically adopted the features that are most compatible across all compilers.

If you want to get a feel for how the unreal-engine specific parts of our C++ libraries go, I’d recommend looking around Programming with C++ | Unreal Engine Documentation

I just wanted to expand your answer and explain how it works because it is a common mistake that people that move from managed code to native make.

Sorry if I offended you.

No offense taken