D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3985 - Documentation of the main() Function
Summary: Documentation of the main() Function
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: spec
Depends on:
Blocks:
 
Reported: 2010-03-19 03:56 UTC by ludovica
Modified: 2014-02-15 02:43 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ludovica 2010-03-19 03:56:49 UTC
According to the documentation, main() must be declared using one of the
following forms:

http://www.digitalmars.com/d/2.0/function.html
void main() { ... }
void main(char[][] args) { ... }
int main() { ... }
int main(char[][] args) { ... }

However with the latest D2 compiler I can write:
import std.stdio;

void main (string[] args) {
  writeln("main with string[]");
}

Actually I think that it is pretty good to be able to have main() with string[]. Bearophile on the forums even suggest:
In practice in D2 you can even use main(immutable string[] args), that I think is the best form
Comment 1 bearophile_hugs 2010-03-19 09:02:34 UTC
The compiler is OK. It's just a little problem in the D2 docs.
Comment 2 Walter Bright 2012-01-23 16:01:09 UTC
Fixed a while ago.