tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* DEC cxx question
@ 1997-04-07  3:44 Ray Lauff
  0 siblings, 0 replies; only message in thread
From: Ray Lauff @ 1997-04-07  3:44 UTC (permalink / raw)
  To: tru64-unix-managers


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@thunder.ocis.temple.edu : (215) 204-5678 : Temple University

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-04-07  3:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-04-07  3:44 DEC cxx question Ray Lauff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox