[comp.lang.c] Porting to a 3b2

kehoe@scotty.dccs.upenn.edu (Brendan Kehoe) (08/17/90)

 Ever have one of those days?
 I wrote a program first originally in QuickC..then the folks using it
suggested porting it over to Unix, soo I rewrote it on my Sun and it worked
great! But, being that I work for the gov't and all, they of course wanted it
to work on the AT&T 3b2 -- so I bring the source over there, thinking that I've
made it as vanilla as I could, and *slam* was I wrong.
 It refuses any sort of prototyping or function predeclaration at all; it
won't let me do something like:
	int (*step[7])(int *) = { *step1, *step2, *step3, .., *step7 };
 It won't let me do any sort of automatic initialization at all (like doing
char *x[8]={"step1", "step2", "step3", ... etc };
 which has *really* made me grow to hate that machine. Is it K&R compatible
at all?? I've tried doing the above with and without the array width (8),
to no avail. I'm convinced that the 3b2's not a machine to write software
for...please prove me wrong!

Brendan Kehoe         -    Sun Network Manager   - brendan@cs.widener.edu
brendan@world.std.com - brendan@chinet.chi.il.us - brendan@cup.portal.com
brendan@wet.uucp      - brendan@zorch.sf-bay.org - Ad infinitum ... 

karl@haddock.ima.isc.com (Karl Heuer) (08/17/90)

In article <28562@netnews.upenn.edu> kehoe@scotty.dccs.upenn.edu (Brendan Kehoe) writes:
>[Tried to port a program, but the compiler doesn't support prototypes or
>automatic aggregate initialization.]  Is it K&R compatible at all??

Ah, how naive today's youth; the new standard is in place for but a year, and
they believe there's never been anything else.

You are describing a pre-ANSI compiler.  Second edition K&R describes ANSI C;
the implementation in question adheres to First edition K&R (plus the
enhancements that were added to the language shortly after publication).
Function prototypes and automatic aggregate initialization are features that
are new to ANSI C.

Either obtain an ANSI C compiler (gcc is a good choice), or rewrite your code
to be compliant to Classic C.  The former is probably easier.

Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint