tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Ray Lauff <ray () thunder ! ocis ! temple ! edu>
To: tru64-unix-managers
Subject: DEC cxx question
Date: Mon, 07 Apr 1997 03:44:43 +0000	[thread overview]
Message-ID: <96078611110241.tru64-unix-managers.marc@archive.invalid> (raw)


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

                 reply	other threads:[~1997-04-07  3:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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