Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.std.c Subject: Re: 7.17.7.5 The atomic_fetch and modify generic functions and "address types" Date: Fri, 27 Dec 2024 17:24:56 -0800 Organization: None to speak of Lines: 37 Message-ID: <87y100tx93.fsf@nosuchdomain.example.com> References: MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Sat, 28 Dec 2024 02:25:01 +0100 (CET) Injection-Info: dont-email.me; posting-host="474f668e455686f89f5a77fb09d755b0"; logging-data="4152344"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7dLZhsmhKhPGfiohXX1A9" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:lEATJrayB8gaajZ7iCFxLOb89dA= sha1:pyrQ955FwqL8yqUbeyiWMNIS+ts= Xref: csiph.com comp.std.c:6663 Andrey Tarasevich writes: > 7.17.7.5 says (https://port70.net/~nsz/c/c11/n1570.html#7.17.7.5) >> 1 The following operations perform arithmetic and bitwise >> computations. All of these operations are applicable to an object of >> any atomic integer type. None of these operations is applicable to >> atomic_bool. > > If I understand it correctly, this wording is intended to restrict > these operations to integers types only. I.e. they shall not be > applied to atomic pointer types. Is that correct? > > Later 7.17.7.5 also says > >> 3 For address types, the result may be an undefined address, but the >> operations otherwise have no undefined behavior. > > However, I was unable to find any mention of "address types" anywhere > in the standard. What types are "address types"? I think you've found an error in the standard. It also appears in the C17 and the N3096 and N3301 drafts. There are no other occurrences of "address type" in the standard. Presumably it was meant to be "pointer type", but pointer types are already excluded. An aside: The wording that excludes _Atomic bool is improved in N3096: The following operations perform arithmetic and bitwise computations. All these operations are applicable to an object of any atomic integer type other than _Atomic bool or the atomic version of an enumeration with underlying type bool. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */