Does "complex xxx" work?

Gabriel Dos Reis gdr@integrable-solutions.net
Sat Jun 21 21:03:00 GMT 2003


Zack Weinberg <zack@codesourcery.com> writes:

| Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
| 
| > Scott Robert Ladd <coyote@coyotegulch.com> writes:
| >
| > | H. J. Lu wrote:
| > |  > c_common_nodes_and_builtins calls
| > |  >
| > |  >  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
| > |  >                                get_identifier ("complex float"),
| > |  >                                complex_float_type_node));
| > | [snip]
| > |  >
| > |  > What are they used for? I still can't use any of those in C++.
| > | 
| > | C99 defines a new keyword, _Complex, for creating various complex
| > | number types; by including <complex.h>, a programmer can used the
| > | synonym "complex" for "_Complex".
| > | 
| > | I've used these types in gcc-compiled C99 programs, so they must work.
| >
| > I believe the real question was: Why does GCC treat "complex" (not
| > _Complex)  as keyword?  Clearly that is a bug in GCC.
| 
| It's a historical extension.

Note that it does not work in C++.  Therefore it is pointless code to
run in C++.  I'm not even sure it is used in that form in C.
At any rate it should be revomed, as the workaround is simple.

-- Gaby



More information about the Gcc mailing list