🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Wed, 04 Jan 1989 05:16
g++ hash problems with typedefs and parameters
#1599
Author: "Douglas C. Schmidt"
Date: Wed, 04 Jan 1989 05:16
39 lines
1629 bytes
Hi,

   The following demonstrates a ``bug'' with g++ 1.32 ( I'm not sure if this
is a bug or a feature! ).

   The code below is derived from the AT&T 1.2.1 cfront source code ( it
obviously compiles with cfront ;-) ).  

----------------------------------------
typedef class expr * Pexpr;
typedef class vec * Pvec;

Pexpr cdvec ( Pexpr vec );
----------------------------------------

However, g++ 1.32 doesn't like it:

----------------------------------------
g++ version 1.32.0

 /usr/public/lib/g++/gcc-cpp -+ -v -I/cd/ua/schmidt/include/ -undef
-D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix foo.c /tmp/cca24119.cpp

GNU CPP version 1.32

 /usr/public/lib/g++/gcc-c++ /tmp/cca24119.cpp -quiet -dumpbase foo.c
-fstrength-reduce -finline-functions -fmemoize-lookups -fsave-memoized
-fchar-charconst -version -o /tmp/cca24119.s

GNU C++ version 1.32.0 (sparc) compiled by GNU C version 1.32.
foo.c:4: parse error before `vec'
----------------------------------------

Apparently, g++ thinks the parameter ``vec'' refers to a shorthand for
the typedefed ``class vec.''  This is not unreasonable behavior, but
it doesn't seem compatible with the AT&T version.

Doug
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads