stdatomic.h and atomic_load_explicit()
Joseph S. Myers
joseph@codesourcery.com
Wed Jun 25 15:27:00 GMT 2014
On Wed, 25 Jun 2014, Sebastian Huber wrote:
> In case __auto_type discards const and volatile qualifiers, then shouldn't
> this generate a warning (-Wconst-qual)
>
> __auto_type __atomic_load_ptr = (PTR);
>
> ?
No. The discarding is for qualifiers on the type itself (remembering that
qualifiers on rvalues aren't that well-defined in ISO C), not on the
target of any pointer.
> Why is it necessary to discard the const and/or volatile qualifiers in the
> __auto_type at all? I think for <stdatomic.h> it should be sufficient to
> discard them only in __typeof__.
__auto_type is, by design, meant to be consistent with typeof (while
avoiding multiple evaluation when VLAs are involved, as well as avoiding
exponential blowup of the size of the expansion with nested calls to
macros).
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc
mailing list