Skip site navigation (1)Skip section navigation (2)
Date:      17 Jan 1997 15:17:09 -0800
From:      jdp@polstra.com (John Polstra)
To:        freebsd-current@freebsd.org
Subject:   Re: gcc compiler question
Message-ID:  <5bp19l$a9r@austin.polstra.com>
References:  <32DFDDF6.41C67EA6@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <32DFDDF6.41C67EA6@mindspring.com>,
Ron Bolin  <rlb@mindspring.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5bp19l$a9r>