Deutsch   English   Français   Italiano  
<20250110103252.718@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: So You Think You Can Const?
Date: Fri, 10 Jan 2025 18:37:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20250110103252.718@kylheku.com>
References: <vljvh3$27msl$1@dont-email.me> <vlma9m$2s5e5$1@dont-email.me>
 <vlo0cm$2dkpd$9@dont-email.me> <vlqd4j$3s4ai$1@dont-email.me>
Injection-Date: Fri, 10 Jan 2025 19:37:49 +0100 (CET)
Injection-Info: dont-email.me; posting-host="04b5f0709b08f472ac875a8f159cacc9";
	logging-data="207490"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/Jj3hv0bpxop/z7KrEuLB8V648RWEZ3Wg="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:6guH5TvZBVXf9FcHc9+oWncCDW0=
Bytes: 2015

On 2025-01-10, Andrey Tarasevich <andreytarasevich@hotmail.com> wrote:
> On 01/09/25 12:12 AM, Julio Di Egidio wrote:
>> I do not understand that: `free` is changing the pointed data, so how 
>> can `const void *` even be "correct"?
>
> `free` is destroying the pointed data.
>
> Every object in C object model has to be created (when its lifetime 
> begins) and has to be eventually destroyed (when its lifetime ends). 

That is not so. Literals can be put into a ROM image.

Well, sure, that is created in a factory, and destroyed when recycled.

The point is that the data's lifetime can span over countless
invocations of the program; the program can never observe a time which
is outside of the lifetime of those objects.

> So, destruction is not really a "modifying" operation. Destruction of an 

Destruction by malloc is modifying in any system that recycles the
memory for another allocation.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca