From owner-freebsd-questions@FreeBSD.ORG Wed Apr 1 08:40:15 2009 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 026DB106564A for ; Wed, 1 Apr 2009 08:40:15 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 6F3C48FC29 for ; Wed, 1 Apr 2009 08:40:14 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id n318dlSp050634; Wed, 1 Apr 2009 10:40:11 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id n318dkuJ050633; Wed, 1 Apr 2009 10:39:46 +0200 (CEST) (envelope-from olli) Date: Wed, 1 Apr 2009 10:39:46 +0200 (CEST) Message-Id: <200904010839.n318dkuJ050633@lurza.secnetix.de> From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG, Polytropon , Gary Kline In-Reply-To: <20090331210142.7dcb52ec.freebsd@edvax.de> X-Newsgroups: list.freebsd-questions User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Wed, 01 Apr 2009 10:40:12 +0200 (CEST) Cc: Subject: Re: Why?? (prog question) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@FreeBSD.ORG, Polytropon , Gary Kline List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2009 08:40:15 -0000 Polytropon wrote: > FreeBSD defines additional exit codes to specify the reason for > exiting more precisely in /usr/include/sysexits.h - for your > example, exit(EX_USAGE); would be a good exit code. Actually, no. The purpose of the codes is for communication between SMTP processes (e.g. between an MTA such as sendmail and a delivery agent such as procmail), so the MTA can determine the meaning (severity) of the error and how to proceed. The only standard exit codes for "normal" programs are EXIT_SUCCESS and EXIT_FAILURE. You should use these. > [where to put braces] > In fact, I'm sticking to the concept that only the highest level > of "code groupers" deserve a new line {: these are functions in > C and class methods in C++. Everything else has the { appended > (after a space) to the construct that causes the {. So if you find > a }, you only need to look up. It's obvious that a } is caused > by a {, but you want to know the construct that made it appear, > for example if(), while(), a struct definition or something similar. > With this concept at hand, looking up will make you find this > construct in question at the first glance. Of course this is purely a matter of taste and personal preference. My preference is similar to yours, but my main reasoon is to save space. I think it is a ridiculous waste of space if every third line consisted only of a sole brace (opening or closing). To my eye, such lines that are almost empty break the natural structure of a piece of source code. I insert empty lines quite often in order to group source lines logically, but brace lines break that grouping visually. That's probably one of the reasons why I like Python so much: There are no braces for source structuring at all. This allows me to write very compact code _and_ structure it logically at the same time, making it easily readable and comprehensible. Furthermore, Python gets rid of all of the brace problems that C has, e.g. relating an "else" to the wrong "if" when multiple "if" statements are nested, and forgetting to add braces when you add a second line to an "if" branch (unless you always use braces in C, even when they're superfluous, but again that's a waste of space and does not really improve readability). I could go on for hours, but this is really off-topic now, so we should take this to the -chat list (or to private mail). Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs." -- Robert Firth