On Tuesday, 19 December 2017 at 01:01:57 UTC, cosinus wrote:
[snip]
A second thought that came up was:
Shouldn't there be a compiler-error if someone is ignoring the
return-value of a function?
I saw this C-code:
```C
(void)printf("Hello World!");
```
It cast's the return-value to void to tell the compiler and
other programmer's that the return-value can be ignored.
Ignoring the return value is mainly useful when the primary use
of the function are it's side effects, not it's return value. In
many languages derived from C, people prefer using 'void' return
types + exceptions for error handling.
It is an error to ignore the result of function with no side
effects (D models such functions with the 'pure' attribute):
https://dlang.org/spec/function.html#pure-functions