Article View: comp.std.c
Article #2152Re: return vs. exit(), ANSI vs. POSIX
From: Alan Bowler
Date: Mon, 28 Sep 1992 18:28
Date: Mon, 28 Sep 1992 18:28
26 lines
1847 bytes
1847 bytes
In article <1992Sep25.141556.7799@news2.cis.umn.edu> fin@unet.umn.edu (Craig A. Finseth) writes: > >Personal opinion follows: > > Considering that return from main() is handled specially by > the compiler, I consider _any_ recursive invocation of main() > to be suspect and hence not reasonable. > > Why? Think for a moment: this is one of those cases that is > just begging to be badly handled by a compiler writer. Who > needs this sort of grief? > >End personal opinion. Return to usual sweeping generalizations (:-). You are already making sweeping generalizations. Although there are a few compilers that have special case handling for main, there is no requirment that this be so. The traditional C compiliers handled main() just like any other function. The only thing that distinguished main from any other function was that was the name that library setup called after it had completed everything else. The compiler itself did not do anything special for the name "main". For a lot of hardware, the calling sequence does not really care if the actual number of parameters passed and declared match exactly. Prior to ANSI it was almost amnidatory that stack/call sequences were designed to handle such mismatches. Certainly I have only ever used one compiler that actually generated special code for the name "main".
Technical Details
Message-ID:
<1992Sep28.182846.2095@thinkage.on.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!utcsri!torn!watserv2.uwaterloo.ca!watmath!thinkage!atbowlerReferences:
<1992Sep24.140006.25009@news2.cis.umn.edu> <1992Sep24.194335.20028@merlin.dev.cdx.mot.com> <1992Sep25.141556.7799@news2.cis.umn.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!utcsri!torn!watserv2.uwaterloo.ca!watmath!thinkage!atbowler From: atbowler@thinkage.on.ca (Alan Bowler) Subject: Re: return vs. exit(), ANSI vs. POSIX Message-ID: <1992Sep28.182846.2095@thinkage.on.ca> Organization: /etc/organization References: <1992Sep24.140006.25009@news2.cis.umn.edu> <1992Sep24.194335.20028@merlin.dev.cdx.mot.com> <1992Sep25.141556.7799@news2.cis.umn.edu> Date: Mon, 28 Sep 1992 18:28:46 GMT Lines: 26