public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Arthur Gold <agold@bga.com>
To: help-gcc@gnu.org
Subject: Re: Declaring variables mid-function
Date: Tue, 21 Dec 1999 09:19:00 -0000	[thread overview]
Message-ID: <385FB63D.EA7143FA@bga.com> (raw)
In-Reply-To: <dhV64.1216$QU1.6733@newsfeed.slurp.net>

bowman wrote:
> 
> Jamie Walker <jamie@sagaxis.co.uk> wrote:
> 
> >In standard C, you cannot declare variables part-way through any
> >function.
> 
> I won't stick my neck out and say it is standard, as I don't have
> Harbison & Steele handy, but gcc will accept declarations at the
> head of any block. So
> 
> int foo()
> {
>         int bar;
>         bar = 1234;
>         {
>                 int fubar;
>                 for (fubar=0; fubar<bar; fubar++)
>                         printf("completely fooed\n");
>         }
> }
> 
> should compile. I believe that fubar is at least lexically visible to the
> end of the function, unlike some languages where the scope would be strictly
> the block.
Nope. Strictly the block.

HTH,
--ag
> 
> Comments from the language lawyers are welcome on what exactly the standard
> stipulates are welcome.

-- 
Artie Gold, Austin, TX  (finger the cs.utexas.edu account for more info)
mailto:agold@bga.com or mailto:agold@cs.utexas.edu
--
A: Look for a lawyer who speaks Aramaic...about trademark infringement.

WARNING: multiple messages have this Message-ID
From: Arthur Gold <agold@bga.com>
To: help-gcc@gnu.org
Subject: Re: Declaring variables mid-function
Date: Fri, 31 Dec 1999 22:24:00 -0000	[thread overview]
Message-ID: <385FB63D.EA7143FA@bga.com> (raw)
Message-ID: <19991231222400.YbLAcwNRQj1JkZDZn1IkZa1MWGF05Hlc5LCYYyvpcjU@z> (raw)
In-Reply-To: <dhV64.1216$QU1.6733@newsfeed.slurp.net>

bowman wrote:
> 
> Jamie Walker <jamie@sagaxis.co.uk> wrote:
> 
> >In standard C, you cannot declare variables part-way through any
> >function.
> 
> I won't stick my neck out and say it is standard, as I don't have
> Harbison & Steele handy, but gcc will accept declarations at the
> head of any block. So
> 
> int foo()
> {
>         int bar;
>         bar = 1234;
>         {
>                 int fubar;
>                 for (fubar=0; fubar<bar; fubar++)
>                         printf("completely fooed\n");
>         }
> }
> 
> should compile. I believe that fubar is at least lexically visible to the
> end of the function, unlike some languages where the scope would be strictly
> the block.
Nope. Strictly the block.

HTH,
--ag
> 
> Comments from the language lawyers are welcome on what exactly the standard
> stipulates are welcome.

-- 
Artie Gold, Austin, TX  (finger the cs.utexas.edu account for more info)
mailto:agold@bga.com or mailto:agold@cs.utexas.edu
--
A: Look for a lawyer who speaks Aramaic...about trademark infringement.

  parent reply	other threads:[~1999-12-21  9:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-18 15:01 Shawn
1999-12-18 15:52 ` llewelly
1999-12-31 22:24   ` llewelly
1999-12-18 15:56 ` Jamie Walker
1999-12-18 16:11   ` bowman
1999-12-18 17:44     ` Brendan Murray
1999-12-31 22:24       ` Brendan Murray
1999-12-21  9:19     ` Arthur Gold [this message]
1999-12-31 22:24       ` Arthur Gold
1999-12-31 22:24     ` bowman
1999-12-19  4:01   ` David Wragg
1999-12-19 12:15     ` Jamie Walker
1999-12-31 22:24       ` Jamie Walker
1999-12-31 22:24     ` David Wragg
1999-12-31 22:24   ` Jamie Walker
1999-12-18 16:02 ` Erik de Castro Lopo
1999-12-31 22:24   ` Erik de Castro Lopo
1999-12-31 22:24 ` Shawn

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=385FB63D.EA7143FA@bga.com \
    --to=agold@bga.com \
    --cc=help-gcc@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).