Am Mittwoch, dem 21.08.2024 um 16:34 +0200 schrieb Martin Uecker:
> Am Mittwoch, dem 21.08.2024 um 14:12 +0000 schrieb Qing Zhao:
> 
> > 
> > Yes, I do feel that the approach __builtin_get_counted_by is not very good. 
> > Maybe it’s better to provide 
> > A. __builtin_set_counted_by 
> > or
> > B. The unary operator __counted_by(PTR) to return a Lvalue, in this case,
> > we need a __builtin_has_attribute first to check whether PTR has the
> > counted_by attribute first.
> 
> You could potentially do the same __counted_by and test for type void.
> 
> _Generic(typeof(__counted_by(PTR)), void: (void)0, __counted_by(PTR) = COUNT);

But just doing A. also seems ok.

Martin

Reply via email to