🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1376

Re: prototyping trouble

#1376
From: Jonathan S. Shapiro
Date: Mon, 17 Oct 1988 16:45
41 lines
1551 bytes
In article <8810160211.AA07329@sun.mcs.clarkson.edu> gary@SUN.MCS.CLARKSON.EDU (Gary Levin) writes:
>certain prototype definitions appear not to be accepted.
>
>why does it complain about yyy, but not xxx?  seems that there is a
>curious bug in the prototyping code.
>
>------
>char * yyy();
>extern char * yyy(char *, char);
>
>char * xxx();
>extern char * xxx(int,int);
>-----
>
>Until it is fixed, I can't make use of the prototype checking, because
>the standard includes don't have the prototype info.  (yyy is the same
>as index).

It better not be fixed! It is right!

The reason is this:  When the compiler sees

	char *yyy()

It assumes that all args get passed as 32 bit quantities.  Once it
actually knows that the size of a char is 8 bits, it is free to
(consistently) pass that as an 8 bit or 16 bit quantity if the
architecture allows.

	char *xxx(int, int)

on the other hand, doesn't in any way affect arg passing on a 32 bit
int machine.  Therefore,

	char *yyy(char *, char)

need not have the same stack layout as

	char *yyy()

Jon
Technical Details
Message-ID: <4518@polya.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!mailrus!rutgers!labrea!polya!shap
References: <8810160211.AA07329@sun.mcs.clarkson.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!mailrus!rutgers!labrea!polya!shap
From: shap@polya.Stanford.EDU (Jonathan S. Shapiro)
Newsgroups: gnu.utils.bug
Subject: Re: prototyping trouble
Message-ID: <4518@polya.Stanford.EDU>
Date: 17 Oct 88 16:45:52 GMT
References: <8810160211.AA07329@sun.mcs.clarkson.edu>
Reply-To: shap@polya.Stanford.EDU (Jonathan S. Shapiro)
Distribution: gnu
Organization: Stanford University
Lines: 41