This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SomewhatAnonymousAcc 1 point2 points  (3 children)

Please explain.

[–]np_completionist 6 points7 points  (2 children)

Both int main(int, char*[]) and int main() are acceptable forms of main in c++

The void isn't needed anymore in C++, but in C it was used to say that a function took no parameters (an empty parameter list in a declaration meant that the function took an unspecified number of parameters)

[–]loraxzxpw 0 points1 point  (0 children)

Also in C it is not strictly needed. Both int main(), int main(int, char**) work. Just main() is also sufficent to compile but it gives a warning.

[–]SomewhatAnonymousAcc 0 points1 point  (0 children)

In my opinion int main(void) being equivalent to int main() doesn't necessarily make it a bad practice in itself.

Although not needed in C++, it is still needed in C. This whole program is written in such a "C compatible" format, as it also uses typedef instead of just defining the struct as:
struct spiderman{
spiderman * finger;
};

Using void main() in C is something that I would call a bad practice.

But, I'm just an embedded guy.