From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 46611385800D for ; Fri, 26 Jan 2024 21:47:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46611385800D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 46611385800D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706305663; cv=none; b=DhC6W9/0ouWiWCZrLwkKQKXfJanoL90sz6LRNYfBQpV9J+wukKDB0o2IiQJKNnCHhwkH5bIbIUXE18XWJHoCZg3eUt3zMnY7/tZOPvpvdqlk6lOGEANu7cnZVIMXIJdZZ/xMxpN3Gn4OGEibJ9uLI2LSbFKuvh8HPPQf4QbITpQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706305663; c=relaxed/simple; bh=96i0uY8SyGmY6ogPAhg/A8JK6US2zXCxlNfArsq1c1g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SQmiwSdYVfbVrbGMnVjqINECrtZMszTtBVO/sQ336IlBo0PGjOP/jewm0GfkMHiZnxamzMN8qz+tJWviSOIAyB4lXINg9RM1oK3L+qQjlr5EqDexC/j9k28kEfqfVo/WnQsf9B8k/y/ZT9DWUB6ylGYEK2YWWHY4pHkmGhtQrYo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706305660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=67mRrugeuYKCUJ6UpYfjYZSFh7UAWYO+fSjctUbnKVo=; b=No2TdVmIZWgxRVggsMj4iI3QX32irlcJyUeE1ECo3+L4k6ln/SeFRrSznvrQEjdBOw9BDf iKvil8c6nA3+L2/KQ7DhoxEYJLGoaeiQz1N39wLALpBz8fbb9YpIh0kiphmllz++AINXEI 3vEraH/yu7sEOiLsuIc4uPJkmM1R8iw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-208-H-zCCHOfMdGx009MLa6Fyg-1; Fri, 26 Jan 2024 16:47:39 -0500 X-MC-Unique: H-zCCHOfMdGx009MLa6Fyg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB50D87DC00; Fri, 26 Jan 2024 21:47:38 +0000 (UTC) Received: from greed.delorie.com (unknown [10.22.10.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D47901121313; Fri, 26 Jan 2024 21:47:38 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.15.2/8.15.2) with ESMTP id 40QLlcRv3800340; Fri, 26 Jan 2024 16:47:38 -0500 From: DJ Delorie To: Andreas Schwab Cc: alx@kernel.org, libc-alpha@sourceware.org Subject: Re: free(3) const void * In-Reply-To: <877cjv4wav.fsf@igel.home> (message from Andreas Schwab on Fri, 26 Jan 2024 22:30:32 +0100) Date: Fri, 26 Jan 2024 16:47:38 -0500 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Andreas Schwab writes: > Also, objects in the heap are never read-only. I thought of that, but using "const" in a program can mean something other than "the object is read-only". It can also act as a promise to the user and/or optimizer that an object is not written to, even if doing such is possible. So the original problem of "having to keep a non-const pointer around just to free it" is valid. My post was just to put me in the "too bad, deal with it" category ;-)