From owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org Fri Oct 23 06:14:22 2015 Return-Path: X-Original-To: sc22wg14-domo2 Delivered-To: sc22wg14-domo2@www.open-std.org Received: by www.open-std.org (Postfix, from userid 521) id AEF1B357126; Fri, 23 Oct 2015 06:14:22 +0200 (CEST) Delivered-To: sc22wg14@open-std.org Received: from mail-qk0-f172.google.com (mail-qk0-f172.google.com [209.85.220.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by www.open-std.org (Postfix) with ESMTP id 43603356DEA for ; Fri, 23 Oct 2015 06:14:22 +0200 (CEST) Received: by qkca6 with SMTP id a6so66162206qkc.3 for ; Thu, 22 Oct 2015 21:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=Zm5Dz9R0aNXyXwE7htWorpPun1nJWJC6uFVg5ttKeaw=; b=rKKphcE40dNephX5xtROGm2Oo6+Op/pClm1DJXG9+J+9qAtWvUszXiHkclkKdZs6ft JwI8hVeXM+4nDGJ0eddC2kGUFaWwFB5f80tXZNYKxUR6/RcuFG3CA0q/NNjln98/zXSk 0QNNsC7QetOB6yrX8Rb5uuG1weLHqhyqzbjsKIy1zY0UPymImpTXO+Xd7s05OVIRTNaY koZg5PXpfj/VndWyLc3Fk4GXE23qjVSJSdwgICYZktnTjS4CXrzkedoGnzcriBpyKBJw VHBcN/ReoL2qYuhXvXKWAMhh/tIWqZzlWBfhMcnWaSb0Tt2eERPSENPt0qCMUGwMnDun M1Sw== X-Received: by 10.140.19.13 with SMTP id 13mr22860859qgg.97.1445573660874; Thu, 22 Oct 2015 21:14:20 -0700 (PDT) Received: from [192.168.0.26] (70-59-0-242.hlrn.qwest.net. [70.59.0.242]) by smtp.gmail.com with ESMTPSA id n48sm6727850qgd.35.2015.10.22.21.14.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 21:14:20 -0700 (PDT) Message-ID: <5629B41A.3000601@gmail.com> Date: Thu, 22 Oct 2015 22:14:18 -0600 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: "sc22wg14@open-std.org" Subject: atomic_fetch and modify generic functions Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-sc22wg14@open-std.org Precedence: bulk Back in 7.17.1, in paragraph 5, there is the text parts of which I quoted in my previous post: In the following synopses: -- An A refers to one of the atomic types. -- A C refers to its corresponding non-atomic type. -- An M refers to the type of the other argument for arithmetic operations. For atomic integer types, M is C. For *atomic pointer types*, M is ptrdiff_t. Looking through section 7.17 to see where M is used, I find only one. It says this: 7.17.7.5 The atomic_fetch and modify generic functions 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. but then in the Description section of atomic_fetch: For signed integer types... For address types, the result may be an undefined address, but the operations otherwise have no undefined behavior It looks like the middle paragraph is incorrect or incomplete and the functions are applicable objects of atomic integer types and atomic pointer types. In addition, what exactly does it mean for an operation to be applicable to a type? Is it ill-formed to use it with a different type (i.e., is a diagnostic required). Or is it undefined? FWIW, the implementations I have tested accept atomic _Bool and atomic pointer types in addition to atomic integers. One also accepts non-atomic integers. Martin