I am trying to compile a test C++ program on DU 4.0b using "DEC C++
V5.4-006 on Digital UNIX (Alpha)". According to the December 96
ANSI standard, the following "for" loops should be valid:
#include <iostream.h>
------------------------------------------------------------------
main()
{
const int last_a = 8;
int a[last_a];
for ( int i = 0, j = 0; i < last_a; a[i++] = ( j += 2 ) );
for ( int i = 0; i < last_a; i++ )
cout << "a[" << i << "] = " << a[i] << endl;
}
------------------------------------------------------------------
When I compile the program, I get the following error message:
cxx: Error: test.C, line 10: In this declaration, "i" has no linkage and
has a prior declaration in this scope at line number 8 in
file test.C.
for ( int i = 0; i < last_a; i++ )
------------------^
Is this a fault in the DEC C++ compiler? The program compiles correctly
under g++. Am I missing a flag on the compiler that I should know
about :) ?
Thanks in advance for any info.
ray
--
Ray Lauff : ray_at_thunder.ocis.temple.edu : (215) 204-5678 : Temple University
Received on Mon Apr 07 1997 - 05:56:08 NZST