On 02/04/2016 09:09 PM, Marek Polacek wrote:
We've already been asked to add something like __typeof_noqual, e.g.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39985#c3 .  In a similar PR,
I wanted to modify __typeof to drop all qualifiers, but Joseph suggested
instead to add a new typeof variant:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65455#c19
(or adjust __typeof to only drop all qualifiers on rvalues?).

Thanks for the pointers. I should have expected that this would have come up before. I wish I would have seen them earlier, like, say, 7 years ago...

So this makes sense, though I don't see the need for __typeof_noas if we
can have __typeof_noqual.

#define segment_to_flat(ptr) \
  ((__typeof_noas(*(ptr)) *) ((uintptr_t)(ptr) + segment_offset))

preserves const and volatile on the pointed-to type while stripping the address space.

It's something that cries out for user-defined named address spaces, but the latter is something that would require quite a bit more development effort to get right.


r~

Reply via email to