🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1523

g++ 1.27 fails to accept valid C and C++ construct.

#1523
From: "Douglas C. Schmidt"
Date: Fri, 11 Nov 1988 03:47
48 lines
2012 bytes
Hi,

   The following short program does not compile under g++ 1.27.
However, I believe that it is valid ANSI-C, and it works under both
gcc and AT&T's CC 1.2.1.  After all, a[i] is *obviously* equivalent to
i[a] ;-)...

----------------------------------------
#include <stdio.h>

main ( int argc, char **argv ) {
   for ( ; *argv; argv++) {
      int i;
      for ( i = 0; i [ *argv ]; i++ ) {
         putchar( i [ *argv ] );
      }
      putchar( '\n' );
   }
}
----------------------------------------

The compiler diagnostic is:

----------------------------------------
g++ version 1.27.0
 echo use .cc filename extension!
use .cc filename extension!
 /usr/public/lib/g++/gcc-cpp+ -v -I/cd/ua/schmidt/include/ -undef
-D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix test.C /tmp/cca21732.cpp
GNU CPP version 1.27.0
 /usr/public/lib/g++/gcc-c++ /tmp/cca21732.cpp -quiet -dumpbase test.C
-fchar-charconst -noreg -version -o /tmp/cca21732.s

test.C:6: [] applied to non-pointer type
test.C:7: [] applied to non-pointer type
test.C:7: [] applied to non-pointer type
GNU C++ version 1.27.0 (sparc) compiled by GNU C version 1.28.
----------------------------------------

thanks,

Doug
----------------------------------------
schmidt@bonnie.ics.uci.edu (ARPA) |   Per me si va nella cita dolente.
                                  |   Per me si va nell' etterno dolore.
                                  |   Per me si va tra la perduta gente.
                                  |   Lasciate ogni speranza voi ch' entrate.
Technical Details
Message-ID: <8811101947.aa21718@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%crimee.ics.uci.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%crimee.ics.uci.edu
From: schmidt%crimee.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.g++.bug
Subject: g++ 1.27 fails to accept valid C and C++ construct.
Message-ID: <8811101947.aa21718@PARIS.ICS.UCI.EDU>
Date: 11 Nov 88 03:47:14 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 48