Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

vesoljc

function main

This topic is 5399 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I''m not sure of the official standing on this point. However, GCC will not allow main to be overloaded. This is because, I believe, it may be called from a C-written program (such as the kernel initiating the program) and C doesn''t handle that. It sucks, I know. I suppose in the right environment one could have the compiler allow this. It would be nice, for example, on systems without a command line in the traditional UNIX sense. (perhaps all arguments are passed through a pipe or socket or some event structure)

Share this post


Link to post
Share on other sites
The only standard declarations for main are: int main() or int main(int, char*[]). Anything else is compiler-dependent.


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan (C programming language co-inventor)

Share this post


Link to post
Share on other sites
quote:
Original post by ironfroggy
perhaps all arguments are passed through a pipe or socket or some event structure


You do that by redirecting the standard file descriptors.


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan (C programming language co-inventor)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!