Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmSfN-00086s-MY for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Sep 2016 21:33:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bmSfN-0000yp-9n for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Sep 2016 21:33:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bmSfM-0000yj-Li for pgsql-hackers@postgresql.org; Tue, 20 Sep 2016 21:33:24 +0000 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bmSfJ-0000Rw-LQ for pgsql-hackers@postgresql.org; Tue, 20 Sep 2016 21:33:24 +0000 Received: by mail-qt0-x244.google.com with SMTP id 11so960377qtc.3 for ; Tue, 20 Sep 2016 14:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=xuxGXaQ4mC+Xj2Fv33sBmd3bLT1Q3ORvyk8eSi38yx0=; b=gO9QEwkH9HQjKImtsHu8D6E0GyODSYD10U8oS3TzgrvFjb9sy2Wn9hwsJu5hP3uz7f T1wZLfr4UsDZtEhQrJtmbVde7ak/FjYQjY5iDGc5op21iFIje1D5acrGcM0t+8xERSHc Iz9WDZnxWXUTJ3C2962l05UJzUeKP330MnCsY3l4lW5uiU281CuL72OhAWKnlkc+Br/D qUclW8u8iUQYPBNBsJgoGrognWasEFZfZeqhCe1G35CMlW7sQiwBIINcvSVr5NDNU/JH p3zadf5b1ahvLl6iQvE4wvvIx17BX1IsTEQjr4LrwRUWr1YYKT9oLVV01U1UBu3SVnl3 WKlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=xuxGXaQ4mC+Xj2Fv33sBmd3bLT1Q3ORvyk8eSi38yx0=; b=HXYB/LNPMuptxZpkEK13UumeaUs89V61NHiqpqm0hqXXORqHtrCZrlppBCfZn6qpG1 R4l5h1pAm4ZnIsCARXq9yOU6c4YBWd2QvXNjGBGRt8lJhXSKirZ4YdbRY9vXhnZr2ZDG uRsi3ULI2uNFfDSnO0ROacEnim0mgPJQQXedQ0xsbsi4iBj6sl+XSqUBP6Tizrh0eq6h ssMV2RjEX4DDANXjIDl+y3dfNVI61+z6TyCnkRQEQY4zsU79B9pG/JAeGMQF69gYfcWc gW9nx1n+DPbRiPmbkXiTVrsJFWH+/jUq4yImDIS/kZaAcsjAEVkZTFP/rONtIEkF0Iyn Cp2w== X-Gm-Message-State: AE9vXwPRgTYJAIncwyrJUqxagQGE5QXH6lGH8OQ+U8Bpvk/JCJqjjvGZBLpjTHWiF2u3tQ== X-Received: by 10.200.47.3 with SMTP id j3mr36527780qta.27.1474407199759; Tue, 20 Sep 2016 14:33:19 -0700 (PDT) Received: from [192.168.2.121] (24-113-69-1.wavecable.com. [24.113.69.1]) by smtp.gmail.com with ESMTPSA id e7sm17148564qtb.9.2016.09.20.14.33.18 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Sep 2016 14:33:19 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: gratuitous casting away const From: Mark Dilger In-Reply-To: <20919.1474402019@sss.pgh.pa.us> Date: Tue, 20 Sep 2016 14:33:17 -0700 Cc: PostgreSQL-development Content-Transfer-Encoding: quoted-printable Message-Id: <96DBB26C-34FF-4090-98A8-6DDA5136AC73@gmail.com> References: <20919.1474402019@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > On Sep 20, 2016, at 1:06 PM, Tom Lane wrote: >=20 > Mark Dilger writes: >> Would patches to not cast away const be considered? >=20 > In general, yes, but I'm not especially in favor of something like this: >=20 >> bool >> PageIndexTupleOverwrite(Page page, OffsetNumber offnum, >> - Item newtup, Size newsiz= e) >> + const char *newtup, Size= newsize) >> { >=20 > since that seems to be discarding type information in order to add > "const"; does not seem like a net benefit from here. The following seems somewhere in between, with ItemPointer changing to const ItemPointerData *. I expect you would not care for this change, but thought I'd check to see where you draw the line: diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginb= ulk.c index 71c64e4..903b01f 100644 --- a/src/backend/access/gin/ginbulk.c +++ b/src/backend/access/gin/ginbulk.c @@ -244,7 +244,7 @@ ginInsertBAEntries(BuildAccumulator *accum, static int qsortCompareItemPointers(const void *a, const void *b) { - int res =3D ginCompareItemPointers((ItemPointer) a, (ItemPointe= r) b); + int res =3D ginCompareItemPointers((const ItemPointerData *) a,= (const ItemPointerData *) b); /* Assert that there are no equal item pointers being sorted */ Assert(res !=3D 0); diff --git a/src/include/access/gin_private.h b/src/include/access/gin_priv= ate.h index bf589ab..2e5a7dff 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -968,7 +968,7 @@ extern ItemPointer ginMergeItemPointers(ItemPointerData= *a, uint32 na, * so we want this to be inlined. */ static inline int -ginCompareItemPointers(ItemPointer a, ItemPointer b) +ginCompareItemPointers(const ItemPointerData *a, const ItemPointerData *b) { uint64 ia =3D (uint64) a->ip_blkid.bi_hi << 32 | (uint64) a->ip_bl= kid.bi_lo << 16 | a->ip_posid; uint64 ib =3D (uint64) b->ip_blkid.bi_hi << 32 | (uint64) b->ip_bl= kid.bi_lo << 16 | b->ip_posid; --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers