This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Help with gcc-3.1
- From: Gokhan Kisacikoglu <kisa at centropolisfx dot com>
- To: Carl Eugen Hoyos <cehoyos at rainbow dot studorg dot tuwien dot ac dot at>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 24 May 2002 10:09:24 -0700
- Subject: Re: Help with gcc-3.1
- Organization: Centropolis Effects, LLC
- References: <Pine.LNX.4.21.0205241529450.2672-100000@rainbow.studorg.tuwien.ac.at>
- Reply-to: kisa at centropolisfx dot com
The following compiles, but I think you've already figured it out;
------------------------------------------------------------------------
typedef struct { double x[3]; } Crd3;
typedef struct { Crd3 c; } Rgb;
#define CRD3(_d0,_d1,_d2) { (_d0), (_d1), (_d2) }
#define RGB(_r,_g,_b) { CRD3((_r), (_g), (_b)) }
const Rgb RGB_WHITE = RGB( 1.0, 1.0, 1.0 );
int main()
{
return 0;
}
------------------------------------------------------------------------
I don't think putting the brackets into paranthesis is standard (ansi).
IMO, these types of constructs are much better dealt in c++, I think you
should migrate...
HTH,
Gokhan
Carl Eugen Hoyos wrote:
>
> The following code is part of our project which compiles without warnings
> using gcc 2.95.2, 2.95.3 and 3.0.4
> If compiled with gcc 3.1, it produces errors. Can somebody tell me if this
> is a bug in gcc 3.1 or our code is not correct?
> Thank you, Carl Eugen Hoyos
>
> -----------------------------------------------------------------
> typedef struct { double x[3]; } Crd3;
> typedef struct { Crd3 c; } Rgb;
>
> #define CRD3(_d0,_d1,_d2) ((Crd3){{ (_d0), (_d1), (_d2) }})
> #define RGB(_r,_g,_b) ((Rgb){CRD3( (_r),(_g),(_b) )})
>
> const Rgb RGB_WHITE = RGB( 1.0, 1.0, 1.0 );
>
> int main()
> {
> return 0;
> }
> -----------------------------------------------------------------