On Wednesday, 2 April 2014 at 08:55:23 UTC, Russel Winder wrote:
On Wed, 2014-04-02 at 00:34 +0000, bearophile wrote:
Alexandre L.:
> int main(string[] args)
> {
If you don't need args, then I suggest to not put it as main
argument. So probably this is better (note no int nor return,
in D they are not needed):
void main() {
...
}
I am not convinced by this argument. The return value (aka exit
code) is
always present, if you ignore this by having a void main, it
will return
0, i.e. main is not a void function even if you claim it is. As
for
ignoring the parameters, this is making use of the fact that
main is the
only function where you do not have to present the correct
signature.
Perhaps this exception should be removed.
The real signature of main in C/C++ is, I believe:
int main(int, char**, char**)
what is the real signature in D?
D main != C main, latter is implemented in D runtime to call the
former. 0 will be also returned by latter, not the former. Also
exception will result in >0 status code even if return type is
void. It effectively just says that you won't manage status code
manually and allows runtime to take care of it.