From: James Colannino <james@colannino.org>
To: linux-c-programming@vger.kernel.org
Subject: Re: Code critique: checking for syntax errors
Date: Mon, 23 Jan 2006 14:59:55 -0800 [thread overview]
Message-ID: <43D55FEB.2070909@colannino.org> (raw)
In-Reply-To: <43D55A90.7030501@ajp-services.net>
Jesse Ruffin wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> James Colannino wrote:
> | Do stricter and older compilers complain if variables aren't
> declared at
> | the beginning of the function?
> | Actually, I was banking on the C99 standard (I guess perhaps it would
> | have been wise for me to say so when I posted the code.)
>
> If you are using a C99 compiler it won't, but older C specifications do
> not allow variable definition anywhere but the beginning or between the
> function declaration and definition (K&R style). Although C99 is gaining
> a lot of ground, I believe that there still are some compilers that
> don't support it at all, and many that don't by default.
What's weird about that is that in order to do variable declarations
within the definition of a for loop, I need to pass -std=c99 to GCC.
However, I don't need to do that in order to simply declare variables
later in the function. That would lead me to believe that C99 is not
required to do so. Could it possibly be a C89 thing? How far back is
considered ANSI C?
James
--
My blog: http://www.crazydrclaw.com/
My homepage: http://james.colannino.org/
"If Carpenters made houses the way programmers design programs, the first woodpecker to come along would destroy all of civilization." --Computer Proverb
next prev parent reply other threads:[~2006-01-23 22:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-21 19:10 Code critique: checking for syntax errors James Colannino
2006-01-22 9:34 ` Jesse Ruffin
2006-01-23 19:47 ` James Colannino
2006-01-23 22:37 ` Jesse Ruffin
2006-01-23 22:59 ` James Colannino [this message]
2006-01-24 0:44 ` Jesse Ruffin
2006-01-24 2:06 ` James Colannino
2006-01-24 9:34 ` 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=43D55FEB.2070909@colannino.org \
--to=james@colannino.org \
--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).