From owner-freebsd-current Fri Jan 17 15:18:32 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id PAA04039 for current-outgoing; Fri, 17 Jan 1997 15:18:32 -0800 (PST) Received: from austin.polstra.com (austin.polstra.com [206.213.73.10]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id PAA04027 for ; Fri, 17 Jan 1997 15:18:29 -0800 (PST) Received: (from jdp@localhost) by austin.polstra.com (8.8.3/8.8.3) id PAA10558; Fri, 17 Jan 1997 15:17:10 -0800 (PST) To: freebsd-current@freebsd.org Path: not-for-mail From: jdp@polstra.com (John Polstra) Newsgroups: polstra.freebsd.current Subject: Re: gcc compiler question Date: 17 Jan 1997 15:17:09 -0800 Organization: Polstra & Co., Seattle, WA Lines: 81 Distribution: local Message-ID: <5bp19l$a9r@austin.polstra.com> References: <32DFDDF6.41C67EA6@mindspring.com> Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk In article <32DFDDF6.41C67EA6@mindspring.com>, Ron Bolin wrote: > /* > > Under Solaris 2.X this compiles with the proper macro substitution > on > savepS = savead-lcl0; > to > LSave [ 6 ] = savead- ( Origin [ 5 ] ); > > But gcc does not > */ > #define savepS LSave[NAreas] > #define NAreas 6 /* number of work areas/stacks */ > #define LocalId 5 > typedef unsigned **PTR; > static PTR *savead, Origin[100]; > #define lcl0 (Origin[LocalId]) > unsigned LSave[100]; > main() > { > > savepS = savead-lcl0; > } Eh? It works fine over here: freebie$ cat foo.c /* Under Solaris 2.X this compiles with the proper macro substitution on savepS = savead-lcl0; to LSave [ 6 ] = savead- ( Origin [ 5 ] ); But gcc does not */ #define savepS LSave[NAreas] #define NAreas 6 /* number of work areas/stacks */ #define LocalId 5 typedef unsigned **PTR; static PTR *savead, Origin[100]; #define lcl0 (Origin[LocalId]) unsigned LSave[100]; main() { savepS = savead-lcl0; } freebie$ cc -E foo.c # 1 "foo.c" typedef unsigned **PTR; static PTR *savead, Origin[100]; unsigned LSave[100]; main() { LSave[6 ] = savead- (Origin[5 ]) ; } John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-knowledge is always bad news." -- John Barth