Close the application immediately
Core Foundation has a macro HALT
that should do the trick, if you really, really think about it, you need to do this:
#if defined(__ppc__)
#define HALT do {asm __volatile__("trap"); kill(getpid(), 9); } while (0)
#elif defined(__i386__) || defined(__x86_64__)
#if defined(__GNUC__)
#define HALT do {asm __volatile__("int3"); kill(getpid(), 9); } while (0)
#elif defined(_MSC_VER)
#define HALT do { DebugBreak(); abort(); } while (0)
#else
#error Compiler not supported
#endif
#endif
#if defined(__arm__)
#define HALT do {asm __volatile__("bkpt 0xCF"); kill(getpid(), 9); } while (0)
#endif
source to share
If you are using a Macintosh application, " [[NSApp sharedApplication] terminate: self]
" will work.
On the iPhone, you can even do " exit(-1)
", but Apple will NOT accept any applications that suddenly or in any way terminate other than the user killing the application. Here is a related question with some helpful answers for you .
source to share
Assuming you don't like exit () or _exit (), which have some cleanup semantics, you can go with s
#include <signal.h>
kill( getpid(), SIGKILL );
And if you are on windows (assuming since "cocoa" is checked) you can use
TerminateProcess( GetCurrentProcess(), -1 );
This is all pretty tough, so you have to be pretty bad for it.
source to share