March 17, 2003 Type spec. required for function return value | ||||
---|---|---|---|---|
| ||||
It is an "advertised" feature of D not having to specify "no arguments" case with "(void)": http://www.digitalmars.com/d/index.html: "Functions that have no arguments The C Way void function(void); The D Way D is a strongly typed language, so there is no need to explicitly say a function takes no arguments, just don't declare it has having arguments. void function() { ... }" OTOH, you still do have to put "void" for functions that have no return values. This is not an elegant asymmetry. Would "fixing" that cause ambiguity in the syntax? Thanks, Sab |
May 02, 2003 Re: Type spec. required for function return value | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sab | "Sab" <sab@neuropolis.org> wrote in message news:b5505c$2573$1@digitaldaemon.com... > It is an "advertised" feature of D not having to specify > "no arguments" case with "(void)": > > http://www.digitalmars.com/d/index.html: > > "Functions that have no arguments > > The C Way > > void function(void); > > The D Way > > D is a strongly typed language, so there is no need to explicitly > say a function takes no arguments, just don't declare it has having > arguments. > > void function() > { > ... > }" > > > OTOH, you still do have to put "void" for functions that have no return values. This is not an elegant asymmetry. > > Would "fixing" that cause ambiguity in the syntax? Yes. |
Copyright © 1999-2021 by the D Language Foundation