9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Comeau At9Fans <comeauat9fans@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] c compiler bug
Date: Thu, 21 Feb 2013 12:17:36 -0500	[thread overview]
Message-ID: <CAE9W7-goLc5meYp899S0_pKkktVStr8_Mv=npkaFe7opzb6C2A@mail.gmail.com> (raw)
In-Reply-To: <212785519fea93fb108b892a64f623ce@brasstown.quanstro.net>

[-- Attachment #1: Type: text/plain, Size: 1139 bytes --]

On Mon, Feb 18, 2013 at 10:02 AM, erik quanstrom <quanstro@quanstro.net>wrote:

> > No, the compiler is simply applying scope rules.  Without that inner
> > declaration explicitly overriding the outer declaration--whether
> > static or extern is used-- it will not compile (eg, if you put "static
> > void fn(Outer*);" or "extern void fn(Outer*);" and remove static from
> > fn in the file scope).
>
> since nested functions are not allowed, applying nested scope seems
> a bit odd.  anyway, ...
>

It's often to be refrained from even if it were extern and not static.


> if the declaration were in the same place but the referenced
> function were in another file, the -T would have prevented the
> link.  my question is, why doesn't the c compiler internally
> apply the same rule?
>

Wild guessing that it's probably an oversight that it got allowed.

--
Greg Comeau / 4.3.10.1 with C++0xisms now in beta!
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?

[-- Attachment #2: Type: text/html, Size: 1760 bytes --]

  parent reply	other threads:[~2013-02-21 17:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-17  2:38 erik quanstrom
2013-02-18 13:02 ` Comeau At9Fans
2013-02-18 14:38   ` Charles Forsyth
2013-02-18 15:02     ` erik quanstrom
2013-02-18 15:10       ` Charles Forsyth
2013-02-21 17:17       ` Comeau At9Fans [this message]
2013-02-21 17:13     ` Comeau At9Fans
2013-02-21 18:13       ` hiro
2013-02-21 18:22         ` John Floren
2013-02-21 18:39           ` erik quanstrom
2013-02-21 18:46             ` Comeau At9Fans
2013-02-21 18:51               ` John Floren
2013-02-21 19:36                 ` hiro
2013-02-21 19:58                   ` andrey mirtchovski
2013-02-21 20:24                     ` Matthew Veety
2013-02-21 20:27                     ` David Leimbach
2013-02-21 20:36                       ` steve
2013-02-21 18:51             ` Kurt H Maier
  -- strict thread matches above, loose matches on Subject: below --
2010-09-14 15:25 erik quanstrom
2010-09-14 20:20 ` Charles Forsyth
2010-09-14 20:59   ` Brantley Coile
2010-09-14 21:07     ` ron minnich
2010-09-15  7:06       ` Sape Mullender
2010-09-15  8:30         ` Charles Forsyth
2010-09-15  8:37         ` Charles Forsyth
2010-09-15 12:20           ` Charles Forsyth
2010-09-15  8:32       ` Charles Forsyth

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='CAE9W7-goLc5meYp899S0_pKkktVStr8_Mv=npkaFe7opzb6C2A@mail.gmail.com' \
    --to=comeauat9fans@gmail.com \
    --cc=9fans@9fans.net \
    /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).