9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <forsyth@terzarima.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] 8c's feature or bug?
Date: Thu,  8 Feb 2007 18:48:48 +0000	[thread overview]
Message-ID: <303879102ad156602837e8affd4c74f0@terzarima.net> (raw)
In-Reply-To: <20070208180145.GA9556@debian>

> I give prototypes of foo and foo1 before use and define them, maybe 8c
> just ignore these prototypes when it see the definitions.

the prototypes are fine, but that one doesn't agree with the actual definition
because the rules require the old style declaration
	void f(b)
	char b;
	{}
to be treated as if it were
	void f(b)
	int b;
	{}
whereas
	void f(char b)
	{}
would be compatible with a prototype
	void f(char);

the diagnostic appears because it doesn't ignore the prototype
(if it ignored it, all would be fine) but is obliged to check it against the
actual definition which, according to the historical rules for that style of declaration,
does not match.

if you find that all a little confusing, that's all the more reason to avoid the old style completely!

for old code that i control, i invariably take the opportunity to update it.
8c -w ... sometimes finds other problems in old code.



  parent reply	other threads:[~2007-02-08 18:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-08 17:28 Lee Duhem
2007-02-08 17:33 ` Charles Forsyth
2007-02-08 18:01   ` Lee Duhem
2007-02-08 17:59     ` Russ Cox
2007-02-08 18:48     ` Charles Forsyth [this message]
2007-02-09 10:09       ` Lee Duhem

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=303879102ad156602837e8affd4c74f0@terzarima.net \
    --to=forsyth@terzarima.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).