Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Novice Newsgroups: comp.lang.java.programmer Subject: Re: Exception Handling Date: Mon, 12 Mar 2012 15:44:49 +0000 (UTC) Organization: Your Company Lines: 42 Message-ID: References: NNTP-Posting-Host: e/7k2xPBpzXEhFbqYoZT4A.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org User-Agent: Xnews/5.04.25 X-Antivirus-Status: Clean X-Notice: Filtered by postfilter v. 0.8.2 X-Antivirus: avast! (VPS 120312-0, 2012-03-12), Outbound message Xref: csiph.com comp.lang.java.programmer:12900 Lew wrote in news:jjje72$984$2@news.albasani.net: > Novice wrote: >> And that brings up a minor point that I've wondered about for a >> while. Is there any standard approach to the integers that are used >> in System.exit (). For instance, does a value of 16 typically >> indicate a severe error while a 4 indicates a minor error? (I'm >> thinking of the old IBM mainframe codes in my example.) It seems to >> me that the Java community may have some conventions in this regard >> that I should follow.... > > No. > > It parallels the use in C of exit values. What's the standard in C? > Not being a C programmer, I don't know. But I googled and all Wikipedia says is that 0 means success and 1 means failure. Another article was more elaborate but, this sentence expresses the essence: "Your program should follow an existing convention if an existing convention makes sense for it". In other words, there is no widely-used standard convention for the value of the integer in exit(). And that's fine. As usual, it means follow the shop standard if there is one; otherwise you can do what you like. > You can answer your own question yourself from first principles. You > should get in the habit of doing that. What is the purpose of the > return value of the program? What uses that value? How does it use > that value? > That's closer to the thought process I'd use if I was trying to _create_ a convention. I was trying to determine if there is already a convention out there that the majority of skilled professionals are using so that I could use it. After further googling, I'm not seeing any. In that case, I'll follow a shop standard if there is one and do my own thing if there isn't, keeping to the "0 is fine and everything else is bad news" convention. -- Novice