Xref: utzoo comp.lang.c:10452 comp.std.c:28 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!killer!vector!rpp386!pigs!haugj From: haugj@pigs.UUCP (John F. Haugh II) Newsgroups: comp.lang.c,comp.std.c Subject: Re: static functions broken in non-Unix compilers? Summary: Summary of responses ... Message-ID: <138@pigs.UUCP> Date: 27 May 88 17:24:34 GMT References: <120@pigs.UUCP> <126@pigs.UUCP> Followup-To: comp.std.c Organization: Big "D" Home for Wayward Hackers Lines: 50 I earlier posted about some difficulty a client had had compiling a collection of C code I had written for him. He had informed me that he had difficulty compiling the code, as he said, `On a number of different compilers'. It turns out the `number' was 1 and the `different compilers' was the C compiler which is provided with VM on a 9370. However, other ANSI-like compilers should have similiar troubles. The declarations for the functions causing the trouble were as follows: struct node *stmt_expr (), *smpl_expr (), *r_mknode (), *st_exp1 (), . . . *ag_total (); with the actual function definition being of the form static struct node *st_exp1 () { . . . } Many person wrote that this did not cause them trouble on their particular compilers. However, a few people with ``ANSI'' compilers did mention some grief. Doug Gwyn, I believe, wrote in a follow up article, for those of you who missed it, that yes, you must declare the function to have the same storage class as the actual function definition itself has. Thinking back (WAY BACK) I do recall this ``feature'' being discussed as a way to inform the compiler that the function linkage may be different for static functions vs. global functions [ namely that certain segmented machines may be able to generate `NEAR CALL's vs `FAR CALL's. ] So in short, all declarations of a function must match the actual form as the function definition itself. - John. -- The Beach Bum Big "D" Home for Wayward Hackers UUCP: ...!killer!rpp386!jfh jfh@rpp386.uucp :SMAILERS "You are in a twisty little maze of UUCP connections, all alike" -- fortune