return in void functions
Christopher Wright
dhasenan at gmail.com
Fri Mar 6 04:17:22 PST 2009
bearophile wrote:
> D has safeties to avoid this kind of code, because it's essentially considered a bug:
>
> But this compiles with no errors:
>
> void foo() {
> return 1;
> }
> void main() {
> foo();
> }
This is an error you'll catch very quickly. If you never use the
function, you won't have an error, which is a problem if you're
releasing a library that you did not test.
More information about the Digitalmars-d
mailing list