[gnu.gcc] ANSI C

heiser@tdw201.ed.ray.com (09/18/90)

I'm taking a C course at Boston University -- we're supposed to be writing
in ANSI C.  I've run across a problem in getting so-called ANSI C things
to work (compile) across different architectures (I want to use my unix
machine at home (sysvr3, GCC) to do the development, then just compile
them at school on their machine (the T/A wants to be able to compile the
pgms there).  For example, I just ran into the following anomoly.  

The C books say to use "function prototypes" like this:

void functname(char arrayname[]);

This works fine when I compile it with GCC, and it also works on a
Harris GCX system running Sysvr3.  On the "Sequent" at school, though,
that function causes the compile to die a miserable death.

Should I be doing this some other way to make it work properly?  Anyone
here know anything about the ANSI compatibility of Sequents vs
Harris and/or GCC?  (It MUST be Ansi compatible, since they told us to
write ANSI code ... hmmm...)

Thanks in advance for your ideas on this.

Bill 



-- 
Work:    heiser@tdw201.ed.ray.com
	 {decuac,necntc,uunet}!rayssd!tdw201!heiser
Home(1): bill%unixland.uucp@world.std.com -or- uunet!world!unixland!bill
	 Public Access Unix Coming Soon!
Home(2): Bill.Heiser@f240.n322.z1.fidonet.org (BBS: 1-508-655-3848)
Other:	 heiser@world.std.com     (Pub. Access Unix)

gt0178a@prism.gatech.EDU (BURNS) (09/19/90)

in article <2465@sud509.ed.ray.com>, heiser@tdw201.ed.ray.com says:
> Anyone here know anything about the ANSI compatibility of Sequents vs
> Harris and/or GCC?  (It MUST be Ansi compatible, since they told us to
> write ANSI code ... hmmm...)

I use Dynix here. (I can never keep Symmetry vs. Balance straight - ours
is the one w/ the 10 parallel 386's.) Anyway, one of our our UA's told me
that Dynix C is horribly non-Ansi. Defining function parameter types
inbetween the ()'s instead of inbetween the ) and {, let alone function
prototypes is a no-no. You'll also run into trouble w/ code sequences like:

main(argc,argv)
int argc;            /* notice where the parm's need to be defined
char ** argv;
{
char tststr[]="This is a test";

Either tststr needs to be defined at 'file scope' - outside of the scope
of a function or main - or needs to be given the static attribute, or else
you'll get an "aggregate initialization error".
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a@prism.gatech.edu