Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Mar 2009 18:41:52 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-questions@FreeBSD.ORG, josh.carroll@gmail.com, Gary Kline <kline@thought.org>
Subject:   Re: Why?? (prog question)
Message-ID:  <200903311641.n2VGfqDH009558@lurza.secnetix.de>
In-Reply-To: <8cb6106e0903302008j5ab06a97odbd32fb68c1a404d@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Josh Carroll wrote:
 > [...]
 > Note also that your main should have an int return type and should
 > return a value.

His main() function _did_ have an int return type (it
wasn't declared to be void), but of course it's better
style to write int explicitly.

By the way, FreeBSD's style(9) recommends to write the
function return type on a separate line and begin the
function name on column 1, like this:

int
main (int argc, char *argv[])
{
        ...
}

The clear advantage is that you can easily grep for the
definition of a particular function in a bunch of source
files:  grep '^main' *.c

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

Perl is worse than Python because people wanted it worse.
        -- Larry Wall



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903311641.n2VGfqDH009558>