Best practice: Abort program

Hello everyone,

as seen in this thread, we are supposed to check if the dynamic memory allocation was successful or not. My question is:
Which of the following commands are best-practice to abort the program in find_and_carve_path in case dynamic memory allocation fails?

// nr. 1

// nr. 2

// nr. 3

Or are we supposed to use any custom exception, like UNUSED() + NOT_IMPLEMENTED()? I couldn’t find any defined behaviour like these for this case, but I’m still not quiet sure :slight_smile:

Thanks in advance,

Calling abort() is what I would suggest. Writing a custom function that prints an error and then aborts is even better, since it allows the user to actually see what went wrong.