A Error System

Its anoying that the editor and the game crashes just because something was null. I dont know if you could do a system that dosent crash the editor when a error occurs. But i would love to see that. Just throw in the editor the error. I think this would be great because this would improove the workflow with ue4.

-Gunschlinger

Well, if the editor crashes, it does so for a solid reason. :rolleyes:

What do you mean by that?
You cannot simply ignore errors. Especially null pointer references.
I dont know what your background in programming is but, judging from the nature of your question, it may be beginner level (?)

A null pointer is referencing data that is no longer valid and could be overwritten with anything. So anything that processed the data being pointed at will receive only garbage.
It can range from, attempted, divisions by zero if operands are refernced by pointers, to reading from invalid addresses out of scope…

In any case, a crash is the last resort to an, otherwise, insolvable situation.

One could analogously argue about the compiler error message about missing semicolons.
So, if the compiler “knows” that a semicolon is missing, why doesnt he just silently add it…?
Well, it could be that there is a semicolon missing, but maybe just an operand was missing in the previous instruction…
Lets say the compiler would add the semicolon, the behavior of the program will become unpredictable. Who knows, maybe it formats the harddrive :slight_smile:

I guess he just means something like putting the whole editor in a try/catch how it works in java. And yes, this would be nice :slight_smile:

iam not a beginner. And i have never sayed that you ignore the error. I came from Unity. And the unity editor does not crashes because of a null pointer.

Im not that expirienced with Java, but if one would set the editor up to trap all exceptions, the performance would be drastically lowered.
Also, if you run the game then as standalone (you surely dont want those tests during gametime), you might run into errors that were masked by the exception handling in the editor…
I guess Epic has put try/except/finally (thats Delphi :slight_smile: ) wherever is seems appropriate.

I hope with the PVS support, those crashes become less :wink:
https://www.unrealengine.com/blog/how-pvs-studio-team-improved-unreal-engines-code

It’s kind of impossible

  1. Native code crashes are uncontrollable, if you do crash code due use of NULL UE4 don’t have even chance to react to it, OS will just shut it down without asking, also in stream it was said that check() crashes because there no guaranty that editor will won’t go out of rail, it better to let it go down. Only way to avoid is to make your code prepared for anything, you need to think of possibilities even if they are not impossible for you to happen.
    2.Editor and game code is integrated, thats why it can’t just stop gameplay in editor… but that might changed, but i think it would require too much work

UE4 is already good in dealing with charshes, code can predict when it happens and prints possible cause on log.

This is incorrect. If you keep a pointer around (that isn’t null) and the object is deleted, then it points at data that is no longer valid. A null pointer doesn’t reference “data that is no longer valid”, it points at nothing.
A null pointer can be overwritten by anything just like any other pointer can, there’s no difference.

Like KVogler and says, you can’t do this reliably in a native language. Unity can’t do it either, they just happen to do it with a managed language sitting ontop of the Mono Runtime.

My computer science teacher taught us “a pointer that points to unallocated data is called a Null pointer”. Years later I found out that this depends on how you use the term “null”.
But it was too late. The terminology already stuck. So I would intuitively call dangling/wild pointers “null pointers”.
Spoiled by teacher… :stuck_out_tongue:

Im still learning C++, so, is “null” in C++ the same as “nil” in Delphi? http://www.delphibasics.co.uk/RTL.asp?Name=Nil
Because Delphi also has a “null”. http://www.delphibasics.co.uk/RTL.asp?Name=Null

Whichone is the closest C++ equivalent?

Yeah, that sounds about right. Nil in Delphi should be the same as a NULL pointer (or a pointer set to 0) in C++.