Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Apr 2015 19:35:29 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        William Waites <wwaites@tardis.ed.ac.uk>
Cc:        freebsd-net@freebsd.org, contact@winterei.se
Subject:   Re: ng_netflow and BGP
Message-ID:  <20150402192937.F1001@besplex.bde.org>
In-Reply-To: <20150402.090554.1118238546466593001.wwaites@tardis.ed.ac.uk>
References:  <20150401.115048.1362042954044146751.wwaites@tardis.ed.ac.uk> <CA%2BP_MZFpu6uwkjE6JCgE-Uk7DVUphb_AYy8x89%2B12-hErw91cw@mail.gmail.com> <551C9651.7050003@winterei.se> <20150402.090554.1118238546466593001.wwaites@tardis.ed.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2 Apr 2015, William Waites wrote:

> On Thu, 02 Apr 2015 10:07:29 +0900, "Paul S." <contact@winterei.se> said:
>
>    > [pmacct's] use of 'return' (with no args) on functions that are
>    > meant to return an int flat out makes it unable to compile on
>    > FreeBSD.
>
> Yes, I found that surprising that any modern C compiler would tolerate
> that at all.

This is interestingly different in C90 and C99.

In C90, the behaviour for returning without a value in a non-void function
is only explicitly undefined if the return value is used.

In C99, it is a constraint error to return without a value.

So C90 compilers should warn about the return but not fail to compile
the file unless they can tell that the return value is used, while C99
compilers should warn about the return and fail to compile the file.

Bruce




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