[cfe-commits] [PATCH] Add extension to allow initializer list to initialize complex numbers by component

John McCall rjmccall at apple.com
Fri Sep 16 18:05:51 PDT 2011


On Sep 16, 2011, at 5:48 PM, Eli Friedman wrote:
> Patch attached.  Simple example this patch allows:
> 
> _Complex float x = { 1.0f, INFINITY }; // Init to (1, Inf)
> 
> This construct is useful in that currently with clang, there is no way
> to correctly represent this construct in static initializers, and
> representing it for non-static variables using __imag__ is messy.
> According to Doug, gcc also will be implementing this extension, and
> it seems like an obvious extension in the sense that there is no other
> meaning which could reasonably be assigned to this construct.
> 
> Note that this extension does not allow eliding the braces; the
> meaning of the following two lines is different:

Ah, okay.  With this proviso, this seems to make sense to me.

John.



More information about the cfe-commits mailing list