C constant expressions proposals

Gabriel Dos Reis gdr@integrable-solutions.net
Sat Aug 14 17:02:00 GMT 2004


"Joseph S. Myers" <jsm@polyomino.org.uk> writes:

| 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!

that is what I suspected but did not fully understand your "which
seems to be existing practice".  I see now what you meant.

| 
| 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

Humm, I don't seem to see a corresponding change in

   http://www.srcf.ucam.org/~jsm28/gcc/const-exprs-gnu.txt

near the end.

-- Gaby



More information about the Gcc mailing list