This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C constant expressions proposals


On Sat, 14 Aug 2004, Gabriel Dos Reis wrote:

> |  I'll also make it so that you can't have 
> | address constants of complex integer type, which seems to be existing 
> | practice.
> 
> What are they used for?

As far as I know, nothing, because the existing practice is that you can't 
have such constants!

int x;
_Complex int y = (int)&x;

doesn't compile, and I don't believe we want it to, even though given the 
rules for layout of complex numbers valid assembler could be produced for 
it whenever it could be produced for corresponding real integers.

I've now updated the rules for GNU C to document handling of complex 
numbers better and to state that implicit conversions are treated as casts 
to avoid that initializer being treated as valid because (int)&x, before 
conversion to _Complex int, is being treated as an address constant.

http://www.srcf.ucam.org/~jsm28/gcc/#const

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]