All of lore.kernel.org
 help / color / mirror / Atom feed
From: wwp <subscript@free.fr>
To: linux-c-programming@vger.kernel.org
Subject: Re: C99 doesn't allow local scope variables?
Date: Tue, 27 Jan 2004 09:05:12 +0100	[thread overview]
Message-ID: <20040127090512.48879f6e@tethys> (raw)
In-Reply-To: <200401262130.35636.tabris@tabris.net>

Hello tabris,


On Mon, 26 Jan 2004 21:30:30 -0500 tabris <tabris@tabris.net> wrote:

[snip]
> [tabris@tabriel tmp]$ gcc test.c -o test
> test.c: In function `main':
> test.c:6: error: `for' loop initial declaration used outside C99 mode
> 
> What does that mean, and why am I not allowed to make a local scope variable
> 
> for a for{;;} loop?
> 
> works fine if i declare the variable outside the loop. But I swear I used to
> 
> do this with gcc 2.95.

ANSI C89 requires int i; to be declared outside from the for(), only ANSI C99
and C++ allow this, IIRC.


Regards,

-- 
wwp

  reply	other threads:[~2004-01-27  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-27  2:30 C99 doesn't allow local scope variables? tabris
2004-01-27  8:05 ` wwp [this message]
2004-01-27 11:45 ` Glynn Clements

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=20040127090512.48879f6e@tethys \
    --to=subscript@free.fr \
    --cc=linux-c-programming@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.