Signature of main [was Sockets between D and C(++) app]
Russel Winder
russel at winder.org.uk
Wed Apr 2 01:54:41 PDT 2014
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?
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
More information about the Digitalmars-d-learn
mailing list