🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #262

Re: compare literals / if( "cat"== "dog") {}

#262
From: fir
Date: Mon, 12 Oct 2026 12:40
39 lines
2866 bytes
Keith Thompson pisze:
> Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>> I don't see fir's posts, so please pardon my replying to fir
>> in this manner
>>
>> On Sun, 11 Oct 2026 18:28:51 +0000, MitchAlsup wrote:
>>
>>> fir <profesor.fir@gmail.com> posted:
>>> -------------------
>>>>
>>>> if("cat" == "cat") will return true and
>>
>> Not necessarily. In reference to string literals (the "cat" and "cat" above),
>> the C standard notes that "it is unspecified whether these arrays are distinct
>> provided their elements have the appropriate values". (ISO/IEC 9899:2024 N3220
>> Working Draft, 6.4.5 String literals, point #7).
> [...]
> 
> I don't believe fir was asserting that it currently works that way in C.
> He was asking whether it can be made to work that way.  That context
> was omitted in the followup.
> 

in to ways:

1) if i can mady my code in c work this way
(thus using string literals as ad-hoc tags, where i could compare them 
as 1-1 pointers)

2) if something is a reason not to introduce it in a standard; 
"samestring literals have same pointers" (which would be handy)


if some really need those strings have different pointers (for some 
reason? like what - making literals lyiong in memory and feeling it in 
order or what?) what is that reason (if someone woul very like need it 
it coud ad some ;keyword' or pragma directive or something ('makw unique 
storage')
Technical Details
Message-ID: <11aikft$3j8es$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11ae962$2365v$1@dont-email.me> <1791743331-5857@newsgrouper.org> <11ah4sk$3324o$1@dont-email.me> <11ah6ls$329bt$6@kst.eternal-september.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: fir <profesor.fir@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: compare literals / if( "cat"== "dog") {}
Date: Mon, 12 Oct 2026 14:40:27 +0200
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <11aikft$3j8es$1@dont-email.me>
References: <11ae962$2365v$1@dont-email.me> <1791743331-5857@newsgrouper.org>
 <11ah4sk$3324o$1@dont-email.me> <11ah6ls$329bt$6@kst.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 12 Oct 2026 12:40:30 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3776988"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19BrvUHfBDOEU2nXcpRkl2d21bGBK/MIF0="; posting-host="4bc1d2b065d74954d211caeafb5306ee"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
 Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:5QRQpIt4taFMFAC6VvvvoW9kX/w= sha256:47CB14mSNpfsBAvsPLFGuXSbMzbhoJKHZj4rcXOVzl4=
	sha1:Hz2komp+Y2OgSUDie7Xt5HCTkAI= sha256:LKeeUkjdeu2zpoTqdIIkEaJqQHkBSpT9iTwtx9yiZmI=
In-Reply-To: <11ah6ls$329bt$6@kst.eternal-september.org>