This is the mail archive of the 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/C++ PATCH to add __typeof_noqual (PR c/65455, c/39985)

On 06/28/2017 11:41 AM, Joseph Myers wrote:
On Wed, 28 Jun 2017, Martin Sebor wrote:

I don't think there is an equivalent, dedicated trait in C++ to
do that either.  One would have to be composed of the lower-level
ones.  There also is no trait that would remove all type qualifiers
(including extensions), or even traits for querying extensions.
So (AFAIK) there is no way in C++ to do exactly what you described.
That of course doesn't mean that it doesn't make sense, just that
it's too advanced even for C++ despite its highly evolved support
for generic programming.  I would suggest that although providing
something like it would be nice, its absence shouldn't stand in
the way of defining the more limited interfaces first.

Does (standard) C++ have any of restrict, _Atomic or address spaces, which
are what indicate doing more than simply things for const and volatile?

No, C++ 17 still has just two qualifiers: const and volatile.
It has no equivalent of restrict, and its equivalent of _Atomic
is a library type (class template).

There's no API, standard or otherwise, for traits to manipulate
implementation-defined qualifiers.  But in C++, qualifiers are
easy to detect, add, and remove, so the absence of standard or
G++-specific traits doesn't prevent advanced users from rolling
their own.

The more limited interfaces could, of course, be __typeof_noqual in some

Actually, despite what I've been arguing, I agree.  I've come
to realize that what makes me uneasy about it is its name: it
makes it sound like a special purpose flavor of __typeof__,
when it really is a general purpose __remove_qualifiers trait.
How does renaming it to something like that sound?


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