From: tabris <tabris@tabris.net>
To: linux-c-programming@vger.kernel.org
Subject: C99 doesn't allow local scope variables?
Date: Mon, 26 Jan 2004 21:30:30 -0500 [thread overview]
Message-ID: <200401262130.35636.tabris@tabris.net> (raw)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
simple C program
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
for (int i=0; i < 2; i++)
printf("crap\n");
};
[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.
- --
tabris
- -
Body by Nautilus, Brain by Mattel.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQFAFc1J1U5ZaPMbKQcRAiJyAJ4namXjJa9zd6Y/VGbR+Y5pyHVjUwCcCy4s
dW251Zxh2o3I97eabiisOMg=
=21yl
-----END PGP SIGNATURE-----
next reply other threads:[~2004-01-27 2:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-27 2:30 tabris [this message]
2004-01-27 8:05 ` C99 doesn't allow local scope variables? wwp
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=200401262130.35636.tabris@tabris.net \
--to=tabris@tabris.net \
--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 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).