Mail Archives: djgpp/1996/06/22/16:07:46
----------
From: Robert Fremin[SMTP:robert DOT fremin AT mailbox DOT swipnet DOT se]
Sent: Saturday, June 22, 1996 12:13 PM
To: djgpp AT delorie DOT com
Subject: Does DJGPP conform to ANSI-C standards with the for () ?
I had great difficulties to compile this code (example):
void main()
{
for (int i=0; i<100; i++);
}
All I got was errors, i not initialized it said.
I tried to move it out to...
void main()
{
int i;
for (i=0; i<100; i++);
}
....but all the same.
It only worked when I (at last) put the i globally.
int i;
void main()
{
for (i=0; i<100; i++);
}
Interesting. I tried the following code with DJGPP V2 and it worked:
int main()
{
int i;
for (i = 0; i < 100; i++);
return 0;
}
Also, when using C++, the following code worked, as expected:
int main()
{
for (int i = 0; i < 100; i++);
return 0;
}
What makes DJGPP unable to use local variables in for() and asm("") ?
Someone?
You can declare variables as static and use them in an asm() construct.
--Michael Phelps
morphine AT cs DOT jhu DOT edu
- Raw text -