Description
This article is from the Apple II
GNO FAQ, by Devin Reade with numerous contributions by
others.
9.3: Are there any other recommendations for porting programs?
A#9.3: There probably are as many opinions as there are programmers.
However, here is a list that seems to work well. Using C as
the source language is assumed:
- Use the occ(1) "-w" flag (#pragma lint -1) whenever possible.
You will have to modify your code if it doesn't use prototypes,
but this is more likely to catch errors and incorrect assumptions.
If you really need to be compatible with K&R compilers, you
can use the following paradigm in your code:
#include <sys/cdefs.h>
int main __P((int argc, char **argv));
int main
#ifdef __STDC__
(int argc, char **argv)
#else
(argc, argv)
#endif
int argc;
char **argv;
{
...
You may have to prototype some of your system header files.
This should not be necessary with the ORCA/C v2.1 header files
(they're already prototyped), but is likely necessary with
earlier versions and some of the GNO v2.0.4 (and earlier) system
header files. See also Q#6.2 and Q#6.6.
- Whenever possible, compile with the occ(1) "-G25" during
development. This will ensure that, in the event of stack
trashing and similar problems, that you get a meaningful
traceback and that your machine (usually) doesn't crash.
If you are using the Splat! debugger, you should use "-g" instead
of "-G25". See also the notes on fork(2) in question Q#9.2.
Make sure you read the both the ORCA/C manual and release notes;
there are times (such as within variadic functions) that you
cannot use stack checking or repair code.
When you're finished development, you can replace the debugging
flag with "-O" for optimization. Don't forget to test your
optimized program before you release it!
 
Continue to:
Share and Enjoy
Bookmark this story so others can enjoy it:
Tags
pc, hardware, Apple II, Apple ][ or Apple //, apple, gno, unix