return the other functions of the void main()

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 9 05:00:24 PDT 2015


On Thursday, 9 April 2015 at 11:38:26 UTC, Rikki Cattermole wrote:
> On 9/04/2015 11:22 p.m., John Colvin wrote:
>> On Thursday, 9 April 2015 at 11:07:05 UTC, Rikki Cattermole 
>> wrote:
>>> On 9/04/2015 11:03 p.m., Dennis Ritchie wrote:
>>>> Hi,
>>>> Is it allowed in D similar designs?
>>>>
>>>> void main() {
>>>>    import std.stdio;
>>>>    return writeln("Hello, world!");
>>>> }
>>>
>>> Sure when:
>>>
>>> import std.traits : ReturnType;
>>> import std.stdio : writeln;
>>>
>>> static assert(is(ReturnType!writeln == int));
>>
>> You might wanna check that :p
>
> I was documenting the usage of return for main function's when 
> the return type of it is int.

Ok... not sure how anyone was supposed to know that. The example 
given used void main. Also, the return type of writeln is void, 
so it's doubly confusing.


More information about the Digitalmars-d-learn mailing list