@@ -2962,8 +2962,8 @@ $(H2 $(LNAME2 main, $(D main()) Function))
2962
2962
2963
2963
$(GRAMMAR
2964
2964
$(GNAME MainFunction):
2965
- $(GLINK MainReturnDecl) main $(D $(LPAREN)$(RPAREN)) $(GLINK2 statement, BlockStatement)
2966
- $(GLINK MainReturnDecl) main $(D $(LPAREN)string[] args $(RPAREN)) $(GLINK2 statement, BlockStatement)
2965
+ $(GLINK MainReturnDecl) $(D main $(LPAREN)$(RPAREN)) $(GLINK2 statement, BlockStatement)
2966
+ $(GLINK MainReturnDecl) $(D main $(LPAREN)string[]) $(GLINK_LEX Identifier)$(D $(RPAREN)) $(GLINK2 statement, BlockStatement)
2967
2967
2968
2968
$(GNAME MainReturnDecl):
2969
2969
$(D void)
@@ -2972,6 +2972,18 @@ $(H2 $(LNAME2 main, $(D main()) Function))
2972
2972
$(RELATIVE_LINK2 auto-functions, $(D auto))
2973
2973
)
2974
2974
2975
+ $(UL
2976
+ $(LI If `main` returns `void`, the OS will receive a zero value on success.)
2977
+ $(LI If `main` returns `void` or `noreturn`, the OS will receive a non-zero
2978
+ value on abnormal termination, such as an uncaught exception.)
2979
+ $(LI If `main` is declared as `auto`, the inferred return type must be
2980
+ one of `void`, `int` and `noreturn`.)
2981
+ )
2982
+
2983
+ $(P If the $(D string[]) parameter is declared, the parameter will hold any
2984
+ arguments passed to the program by the OS. The first argument is typically
2985
+ the executable name, followed by any command-line arguments.)
2986
+
2975
2987
$(P The main function must have D linkage.)
2976
2988
2977
2989
$(P Attributes may be added as needed, e.g. `@safe`, `@nogc`, `nothrow`, etc.)
0 commit comments