Re: Error: cannot return non-void from void function

2014-11-27 Thread Suliman via Digitalmars-d-learn
Full function look like this: auto parseConfig() { auto config = Ini.Parse(getcwd ~ \\ ~ config.ini); string txtlinks = getcwd ~ \\ ~ config.getKey(input_links); if(!exists(txtlinks)) { writeln(Can't find input file with list of links.);

Error: cannot return non-void from void function

2014-11-27 Thread Suliman via Digitalmars-d-learn
auto parseConfig() { auto lines = File(txtlinks, r).byLine; return lines; } Error: cannot return non-void from void function I can't understand the reasons of the error; Can I return auto from function?

Re: Error: cannot return non-void from void function

2014-11-27 Thread Graham Fawcett via Digitalmars-d-learn
On Thursday, 27 November 2014 at 13:07:59 UTC, Suliman wrote: Full function look like this: auto parseConfig() { auto config = Ini.Parse(getcwd ~ \\ ~ config.ini); string txtlinks = getcwd ~ \\ ~ config.getKey(input_links); if(!exists(txtlinks)) {

Re: Error: cannot return non-void from void function

2014-11-27 Thread ketmar via Digitalmars-d-learn
On Thu, 27 Nov 2014 13:07:58 + Suliman via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Full function look like this: auto parseConfig() { auto config = Ini.Parse(getcwd ~ \\ ~ config.ini); string txtlinks = getcwd ~ \\ ~ config.getKey(input_links);

Re: Error: cannot return non-void from void function

2014-11-27 Thread Suliman via Digitalmars-d-learn
ah, that's it! as spec says, D determines function return value from the first 'return' statement it seen. in your case this is `return;`, so function return type is determined to be `void`. if you doing `auto` functions, try to arrange your code so the first `return` returning the actual

Re: Error: cannot return non-void from void function

2014-11-27 Thread ketmar via Digitalmars-d-learn
On Thu, 27 Nov 2014 17:22:35 + Suliman via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: ah, that's it! as spec says, D determines function return value from the first 'return' statement it seen. in your case this is `return;`, so function return type is

Re: Error: cannot return non-void from void function

2014-11-27 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 27 November 2014 at 17:22:36 UTC, Suliman wrote: ah, that's it! as spec says, D determines function return value from the first 'return' statement it seen. in your case this is `return;`, so function return type is determined to be `void`. if you doing `auto` functions, try to

Re: Error: cannot return non-void from void function

2014-11-27 Thread ketmar via Digitalmars-d-learn
On Thu, 27 Nov 2014 21:14:57 + Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: import core.runtime; import std.c.process; writeln(Can't find input file with list of links.); Runtime.terminate();

Re: Error: cannot return non-void from void function

2014-11-27 Thread Daniel Kozak via Digitalmars-d-learn
Dne Thu, 27 Nov 2014 22:21:52 +0100 ketmar via Digitalmars-d-learn digitalmars-d-learn@puremagic.com napsal(a): On Thu, 27 Nov 2014 21:14:57 + Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: import core.runtime; import

Re: Error: cannot return non-void from void function

2014-11-27 Thread ketmar via Digitalmars-d-learn
On Thu, 27 Nov 2014 22:25:10 +0100 Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Dne Thu, 27 Nov 2014 22:21:52 +0100 ketmar via Digitalmars-d-learn digitalmars-d-learn@puremagic.com napsal(a): On Thu, 27 Nov 2014 21:14:57 + Daniel Kozak via