News for hackers. Stuff that matters.
Re:Where do argc and argv come from? by chrisseaton on Monday August 10, 2020 @04:03PM (#24113403)
Now try

  int maim(int argc, char *argv[]) { }
  int main(int argc, char *argv[]) { }
They compile to different code. Can you figure out why?

A function called main is treated differently in this regard to other functions, which is enforced by the standard, and so has to be implemented by the compiler.

Re:Where do argc and argv come from? by kps on Monday August 10, 2020 @04:31PM (#24113646)
Damn, you're right: Currently, “reaching the } that terminates the main function returns a value of 0”. In my defense, that was different in C89, which was the last one I worked on implementing and knew completely: “If the main function executes a return that specifies no value, the termination status returned to the host environment is undefined” and “Reaching the } that terminates a function is equivalent to executing a return statement without an expression.”