Is returning void functions inside void functions a feature or an artifact?

Rekel paultjeadriaanse at gmail.com
Tue Aug 3 10:28:53 UTC 2021


On Tuesday, 3 August 2021 at 00:53:43 UTC, user1234 wrote:
> You got the answer in another reply but here is a bit of more 
> fun:
>
> ```d
> void main() {
>     return cast(void) 1;
> }
> ```

What does casting to void do? Does it just ignore whatever 
follows it?

On Tuesday, 3 August 2021 at 07:23:34 UTC, Patrick Schluter wrote:
> Wow. Just discovered that C accepts it. After 35 years of daily 
> use of C, there are still things to discover.

Hehe, glad to hear I'm not the only one. Feel like making a 
request to add this to the learning pages now "x3


More information about the Digitalmars-d-learn mailing list