[RFC / Patch] C++/26099 or front-end support to type traits

Gabriel Dos Reis gdr@cs.tamu.edu
Tue Mar 13 16:22:00 GMT 2007


Paolo Bonzini <paolo.bonzini@lu.unisi.ch> writes:

| > I'm attaching below the patch, together with a set of simple testcases,
| > it seems rather self-explanatory to me and, well, not too ugly, what do
| > you think?
| 
| I cannot comment on the technicalities but it seems cool!
| For the syntax, I'd prefer something like
| __trait__<__has_trivial_constructor__> (x) which reminds attributes
| (but with a C++ touch on it!) or, alternatively,

I was hoping that we would not need to use C++ template syntax.  I was
hoping that the actual syntax should be C compatible

   __trait__(T, __has_trivial_constructor__)

where the first argument is a type, and the second could be made an
enumeration (known to the compiler), or just identifiers à la
offsetof, or GNU C attributes; with __trait__ itself a built in
function as apposed to a keyword.

[...]

| I understand that the usage should be confined in a header file, so
| the extra ugliness should not be a problem.

agreed.

-- Gaby



More information about the Gcc-patches mailing list