From: "Douglas A. Gwyn" <DAGwyn@null.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] function inconsistently declared
Date: Wed, 2 Oct 2002 09:01:36 +0000 [thread overview]
Message-ID: <3D9A13FE.E52C05F8@null.net> (raw)
In-Reply-To: <821f6979e86cb87e2f87d83def62d004@vitanuova.com>
C H Forsyth wrote:
> in old C,
> f(a, b)
> int a;
> char b;
> {
> ...
> }
> actual parameters for b were always promoted to int
> (since prototypes weren't available, and the compiler didn't maintain a
> file of the types of parameters to internal and external functions, it
> had to assume int for char, double for float etc.)
Actually it didn't *have* to, but it was convenient for the way
PDP-11 function linkage worked.
In the presence of a prototype, it is quite possible for the
compiler to use a linkage that differs from the one used for
unprototyped functions. In this regard also remember that
use of a variable-argument function requires that the ,...)
prototype be visible; quite a few systems use a linkage for
that situation that is different from the one for unprototyped
functions. I still occasionally have to fix up some legacy
code like:
error("foo %d\n",1); /* no prototype in scope */
error("punt\n");
...
void error(char *fmt, int x) {
... something involving &x
}
next prev parent reply other threads:[~2002-10-02 9:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-01 17:42 C H Forsyth
2002-10-02 9:01 ` Douglas A. Gwyn [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-10-01 16:51 Zoltan Jarai
2002-10-01 16:44 rog
2002-10-01 16:32 Russ Cox
2002-10-01 16:23 Zoltan Jarai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D9A13FE.E52C05F8@null.net \
--to=dagwyn@null.net \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).