Skip to main content

Questions tagged [exit-strategy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
3 answers
577 views

Should I use the "die" idiom in C++?

If we implement the following function: template <typename... Ts> [[noreturn]] inline bool die(std::string_view message_format = "", Ts&&... args); We can then write: if (...
einpoklum's user avatar
  • 2,548
1 vote
1 answer
381 views

Which statements can be considered as exit points?

There are many discussions related to whether it is better to have only one or multiple exit points per function, but it is not clear to me which statements can be considered as exit points: only ...
user90726's user avatar
  • 205
1 vote
5 answers
1k views

How do you use exit status code? [closed]

When the program run successfully, usually the program will return 0 status. If there any problems, the we can return value other than 0 at exit. With Exceptions, (as long as the problem is not ...
Mas Bagol's user avatar
  • 469
4 votes
4 answers
4k views

Quit a program in main or in function?

Lets say I have a void method/function to check the arguments of the program: void check(int argc, String argv){ //some irrelevant code } In this function I have some checks to validate the ...
moffeltje's user avatar
  • 251
0 votes
0 answers
56 views

Own Exception or Delegation design pattern to exit a program?

I am writing an application in Java which use MVC pattern design. I have 4 major classes: Main, Controller, Model, View. Main initialize the other three and run launchMenu() in a infinite loop, a ...
Jorge's user avatar
  • 101
17 votes
7 answers
32k views

Non-zero exit status for clean exit

Is it acceptable to return a non-zero exit code if the program in question ran properly? For example, say I have a simple program that (only) does the following: Program takes N arguments. It returns ...
Thomas Eding's user avatar
  • 1,062