This is the mail archive of the gcc-patches@gcc.gnu.org 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: [PATCH] Adding _Dependent_ptr type qualifier in C part 1/3


On Fri, 30 Aug 2019, Akshat Garg wrote:

> > The first question for any new thing that is syntactically a qualifier is:
> > is it intended generally to be counted as a qualifier where the standard
> > refers to qualified type, the unqualified version of a type, etc.?  Or is
> > it, like _Atomic, a qualifier only syntactically and generally excluded
> > from references to qualifiers?
> >
> Can you help me in understanding why the _Atomic is excluded from the
> standard references. I referred to the C standard draft N2310 (
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf) but I couldn't
> understand how it is excluded? I want to know what properties should a
> qualifier have to be in standard qualifiers list?

In the case of _Atomic, it can affect the size and alignment of the type 
to which it is applied, which means it can't be considered a qualifier in 
the nornal semantic sense.

In general you need to consider questions such as: is it safe to convert a 
pointer to unqualified type to a pointer to the corresponding 
_Dependent_ptr-qualified type?  Are conditional expressions between 
pointers whose target types differ in presence or absence of 
_Dependent_ptr safe?  If in general, in such places where the standard 
refers to qualifiers, the existing logic there is also appropriate for 
_Dependent_ptr, that suggests it should be a qualifier semantically.  If 
the standard logic often seems inappropriate for _Dependent_ptr, that 
indicates it's not a qualifier in standard terms.

-- 
Joseph S. Myers
joseph@codesourcery.com


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