Mail Archives: djgpp/1999/02/15/06:02:52
In article <36C7320E DOT FB4111F9 AT lycosmail DOT com>,
djgpp AT delorie DOT com wrote:
> I don't know why this happens, but I do have to say that I do that kind
> of thing often (in C++ mind you). Q, do you have optimizations on?? That
> _might_ to it.
> Carl Marg wrote:
>
> > I'm using DJGPP, and I've noticed that it will not allow me to
> > declare variable in the middle of code, i.e
> > what I'm wondering is this just a part of standard C,
> > is there some option that will change this?
In C++, you can declare variables anywhere in your code, preferably near
first use. In C, it must be before any function in that block. Thus, you
could have something like this, although I've never seen it in real code, and
I'm not sure what the compiler does with it:
int main(void)
{
int x;
for (x=0; x<10; ++x)
printf("%3d", x);
{
int y;
for (y=0; y<10; ++y)
printf("%3d", y);
}
return 0;
}
Fastest Computer on Earth needs you!
http://www.distributed.net - team 844
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
- Raw text -