Article View: comp.sys.apple2.gno
Article #283Re: Crash............
From: David.Empson
Date: Tue, 17 Nov 1992 12:46
Date: Tue, 17 Nov 1992 12:46
39 lines
1930 bytes
1930 bytes
In article <BxtIH1.3wF@news.iastate.edu> achauhan@warsaw.math.macalstr.edu (Amrit Chauhan) writes:
> > int
> > main (int argc, char *argv[])
> > {
>
> > even if you do not use argc and argv.
>
> Hmm, I should probably get in the practice of doing this. What
> would I do if I wasn't writing a shell program? I mean, would you
> still need to be explicit about what gets passed to main?
It won't hurt. In an S16 program written in ORCA/C, you will get zero
for argc. You can also use the shellid() call to see whether you were
launched from a shell: you will get the string "BYTEWRKS" under
ORCA/Shell, or a NULL pointer if launched from GS/OS. GNO probably
returns "GNO " (padded to 8 characters), but as I don't have it,
I can't say exactly.
> If I was writing say a desktop program, what would I use the
> parameters of main for?
You can safely ignore them. In fact, the ORCA/C manual claims that
you can avoid mentioning them, i.e. use:
int main(void)
The startup code must be using 'stack repair' so that it doesn't mind
whether or not main() removes its arguments from the stack.
Of course, in the case of an NDA or CDA, there shouldn't be a function
called main() - you explictly specify the entry function in the
#pragma nda or #pragma cda line.
--
David Empson
Internet: David.Empson@bbs.actrix.gen.nz EMPSON_D@kosmos.wcc.govt.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand
Technical Details
Message-ID:
<1992Nov17.124603.28062@actrix.gen.nz>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!waikato.ac.nz!comp.vuw.ac.nz!actrix!David.EmpsonReferences:
<behrenss.721912181@hphalle6> <BxtIH1.3wF@news.iastate.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!waikato.ac.nz!comp.vuw.ac.nz!actrix!David.Empson Newsgroups: comp.sys.apple2.gno Subject: Re: Crash............ Message-ID: <1992Nov17.124603.28062@actrix.gen.nz> From: David.Empson@bbs.actrix.gen.nz Date: Tue, 17 Nov 1992 12:46:03 GMT Sender: David.Empson@actrix.gen.nz (David Empson) References: <behrenss.721912181@hphalle6> <BxtIH1.3wF@news.iastate.edu> Organization: Actrix Information Exchange Lines: 39