Why?? (prog question)

Oliver Fromme olli at lurza.secnetix.de
Tue Mar 31 09:42:19 PDT 2009

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:

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 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

More information about the freebsd-questions mailing list