[comp.unix.xenix] Function Prototypes and SCO Xenix-386 C

lbr@holos0.uucp (Len Reed) (07/28/89)

After several months in the land of MS-DOS, I'm back working on the
SCO Xenix 386 system.  One of the pluses (and there are few) of working on
MS-DOS was the ANSI extensions of Microsoft C 5.1.  I really got to
like strong typing of arguments.

The Xenix-386 cc command will not support function prototypes if I
use -M3 (generate 80386 code).  This certainly means that cc is forking
a different compiler, and an older one, for -M2 than for -M3.  The -M3
version generates lots of syntax error messages for a line like:
   void my_function ( char *, int **, struct foo *, int);

I am unhappy that the compiler for the new machine is more backward than
the 80286 version.  An 80386 compiler should be far easier to do since
you don't have to worry about near and far and 64K segments and stupid
register restrictions like "you can say [BP+DI] but not [BP+CX]."

Even worse, though, is the documentation.  The manuals go on and on about
ANSI and function prototypes, but nowhere do they say anything about the
stuff not working with -M3.  The compiler switches are documented in several
places, and every list is different.

What's the deal here?  Am I missing the fourth list of compiler switches
that has the magic key?  Is SCO doing anything about this?
-- 
Len Reed
Holos Software, Inc.
Voice: (404) 496-1358
UUCP: ...!gatech!holos0!lbr

davidsen@sungod.crd.ge.com (William Davidsen) (07/29/89)

In article <1989Jul27.171720.1948@holos0.uucp> lbr@holos0.UUCP (Len Reed) writes:

| The Xenix-386 cc command will not support function prototypes if I
| use -M3 (generate 80386 code).  This certainly means that cc is forking
| a different compiler, and an older one, for -M2 than for -M3.  The -M3
| version generates lots of syntax error messages for a line like:
|    void my_function ( char *, int **, struct foo *, int);

  You must have an *OLD* version. Both the current version I have at
work and the previous version I have home (got it about March89) work
just fine in that regard.
	bill davidsen		(davidsen@crdos1.crd.GE.COM)
  {uunet | philabs}!crdgw1!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me

vipoon@kepler1.UUCP (Victor I Poon) (07/29/89)

In article <1391@crdgw1.crd.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes:
>
>  You must have an *OLD* version. Both the current version I have at
>work and the previous version I have home (got it about March89) work
>just fine in that regard.

	Too bad it doesn't support the new ANSI standard for declaring
variable types in the function parameters.  Something like:

	void funcA (int a, int b)
	{
	}

still doesn't work.  It would be nice to see if the next release of
SCO's C compiler adheres to the new standard but you can't always
have everything, can you?

Victor Poon
-- 
Victor I. Poon		{acsm, lilink, polyof, sbcs}!kepler1!vipoon
Kepler Financial Management, Ltd.
It was the best of times, It was the worst of times, ...

wht@tridom.uucp (Warren Tucker) (07/30/89)

In article <1989Jul27.171720.1948@holos0.uucp>, lbr@holos0.uucp (Len Reed) writes:
> The Xenix-386 cc command will not support function prototypes if I
> use -M3 (generate 80386 code).  This certainly means that cc is forking
> a different compiler ...
CC does fork a different compiler for -M3, but function prototyping
works very well here with Xenix 386 Development System 2.3.1.
-- 
-------------------------------------------------------------------
Warren Tucker, Tridom Corporation       ...!gatech!emory!tridom!wht 
Ker-au'-lo-phon.  An 8-foot partial flue-stop, having metal pipes
surmounted by adjustable rings, and with a hole bored near the top
of each pipe, producing a soft and "reedy" tone.

chip@vector.Dallas.TX.US (Chip Rosenthal) (07/30/89)

It really scares me to see so many people so concerned about prototypes
in cc.  It appears that they are trying to use them as a replacement for
lint, which they are not.  I say I'm concerned because lint currently
doesn't support prototypes, and I'm infering from this discussion that
this isn't even a concern for anybody.

Personally, I went on a prototype kick for about six months about two
years back.  Everything was strictly prototyped, and I had a set of
standard macros to elide the prototypes for lint.  I would say that during
this entire time, prototypes provided me absolutely no benefit whatsoever.

But then again, lint is an integral part of the way I develop.
-- 
Chip Rosenthal / chip@vector.Dallas.TX.US / Dallas Semiconductor / 214-450-5337
"I wish you'd put that starvation box down and go to bed" - Albert Collins' Mom

lbr@holos0.uucp (Len Reed) (07/31/89)

In article <1989Jul27.171720.1948@holos0.uucp> lbr@holos0.UUCP (Len Reed) (me)
writes:
> The Xenix-386 cc command will not support function prototypes if I
> use -M3 (generate 80386 code).

I'm running software development 2.3.0.

I mistakenly grouped function prototypes and function definitions, thinking
that you had to say either:
    long function();    /* old-style prototype tells only function type */
    .
    .
    long function(a, b);    /* function definition: args and types separately */
        char *a;
        long b;
    { /*body*/ }
or
    long function(char *, long);    /* ANSI prototype */
    .
    .
    long function(char *a, long b); /* ANSI function definition */
    { /*body*/ }

-M2 supports both ANSI prototypes and function definitions.  -M3 supports
only ANSI prototypes.  Function definitions must be given old style.  The
compiler does support argument type checking, though--if you use an ANSI
prototype the argument types given in the old-style function declaration
must match.

So I have my strong typing--it's just syntacticly a mixed bag.

I suppose this resulted from an evolving ANSI standard.  Since I went from
old K&R to Microsoft C 5.0, I was surprised when I came upon the missing link.
-- 
Len Reed
Holos Software, Inc.
Voice: (404) 496-1358
UUCP: ...!gatech!holos0!lbr