Deutsch   English   Français   Italiano  
<vlv2e3$rcjb$1@dont-email.me>

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: James Kuyper <jameskuyper@alumni.caltech.edu>
Newsgroups: comp.lang.c
Subject: Re: So You Think You Can Const?
Date: Sat, 11 Jan 2025 19:29:55 -0500
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <vlv2e3$rcjb$1@dont-email.me>
References: <vljvh3$27msl$1@dont-email.me> <vlma9m$2s5e5$1@dont-email.me>
 <vlolsf$3cnll$4@dont-email.me> <vlqd9p$3s4ai$2@dont-email.me>
 <vlqstb$3uk5j$1@dont-email.me> <87v7umpkfv.fsf@nosuchdomain.example.com>
 <vltjqc$j8n0$1@dont-email.me> <vlu508$ht1i$1@dont-email.me>
 <vlu5q6$ht1h$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 12 Jan 2025 01:29:55 +0100 (CET)
Injection-Info: dont-email.me; posting-host="1ebcac1cd3bead759ed465e99e5c7a3c";
	logging-data="897643"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX188CkoEu1Psm5OApmWmeQXEnSIU3Ba+03w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:KH3VtIw1yq+5lbo5inNiZE5dC3o=
Content-Language: en-US
In-Reply-To: <vlu5q6$ht1h$1@dont-email.me>
Bytes: 2372

On 1/11/25 11:21, Julio Di Egidio wrote:
....
> In fact, along that line, I could see one might insist that "strictly
> speaking, it should be `void free(void *const p)

You should keep in mind that the 'const' in that declaration is
meaningless. Normally,

"If the function is defined with a type that is not compatible with the
type (of the expression) pointed to by the expression that denotes the
called function, the behavior is undefined." (6.5.2.2p7)

However,

"For two function types to be compatible ... In the determination of
type compatibility and of a composite type, ... each parameter declared
with qualified type is taken as having the unqualified version of its
declared type." (6.7.6.3p14)

Therefore, it's entirely permissible for a function's definition to have
parameters with different qualifiers than the ones specified in the
function declaration. And the ones specified in the function declaration
have no effect on the validity or meaning of any expression using that
declaration. Such qualifiers only have meaning within the function's
definition itself.