I've heard conflicting advice on how to end an application when an error is encountered.
Ideally, I want to make sure I pass an error code back to a calling application, but also cleanup the current application to avoid memory leaks, etc.
Some have said using...
...is sufficient, but I've heard elsewhere that Halt should be used sparingly since resources are not guaranteed to be freed.
I'm leaning towards using...
System.ExitCode := 1;
...but I'm not positive that this passes the correct ExitCode.
Can anyone confirm for me the "best" choice. And if it's neither, what would you recommend? I'm using Delphi XE.