-
Notifications
You must be signed in to change notification settings - Fork 160
/
Copy pathmain_function.c
55 lines (53 loc) · 1.19 KB
/
main_function.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* # main function
*
* ## Call main from the program
*
* Seems legal:
* http://stackoverflow.com/questions/13948562/recursion-using-main-function#comment19237980_13948579
*
* Illegal in C++ however.
*
* ## main signature
*
* - http://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c
* - http://stackoverflow.com/questions/4207134/what-is-the-proper-declaration-of-main
*
* Valid signatures: either:
*
* int main(void)
*
* or:
*
* int main(int argc, char *argv[])
*
* Or equivalent ones to the above:
*
* argc array vs pointer: (TODO why equivalent)
*
* int main(int argc, char **argv)
*
* Default return type `int` (C89 only):
*
* main()
*
* Explicit `void` prototype:
*
* int main(void)
*
* ## main return
*
* Valid returns are:
*
* - `EXIT_SUCCESS` or `0` to indicate success
* - `EXIT_FAILURE` to indicate failure
*
* C99: return is optional. If omited a `return 0` is added to the program.
*
* But just always return to be C89 compatible.
* TODO I think that in C89 it is legal to not use return like for any other function,
* but it leads to UB.
*/
#include "common.h"
int main(void) {
return EXIT_SUCCESS;
}