🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #140

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

#140
From: fir
Date: Sat, 10 Oct 2026 21:02
25 lines
2304 bytes
i must have asked for that but i got somewhat holes im my memory and i 
dont exactly remember sometimes on which i wrote and on which not

the problem is i need this adhos enums strongly and really, but those 
'smth' are to shore i could use two of them f('some','thin') but it gets
uglier and such code is like degraded

in fact there could be quite easy solution - it is use string literals 
as such tags - i mean you dont need to use strcomp , you just need to
have same string literals have same pointer then

if("cat" == "cat") will return true and
if("cat" == "dog") will return false


i probably asked that but if so once again

is there way to enforce it to work?

second thought: its really good in fact, in some case it shows you dont 
need strcomp, and i guess such syntax as if (a=="cat") is practically
not used in C which shows a flaw becouse it should, it should be 'unlocked'

(if that would be 'unlocked' in language, then side effect woudl be 
string literals could be usad as tags (adhoc enums)
Technical Details
Message-ID: <11ae962$2365v$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

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: compare literals / if( "cat"== "dog") {}
Date: Sat, 10 Oct 2026 23:02:54 +0200
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <11ae962$2365v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 10 Oct 2026 21:02:58 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2201791"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX190Hy6i9gZid+XqNpRK96vosJAmWaVr2Bk="; posting-host="786a2f20ee4fc3fd9bbba80a955aa71c"
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:j/nAFOvbZc9XzJEfhbelp3Xbweo= sha256:LKC5VG8QFZDXjRc38FjlBOzAi/JGQDBLPDguRXULZSM=
	sha1:/r5bX9IbfuAv2KaI7KXve31KyEw= sha256:g4HaAQNAuTcH+hKzxHi/eLLCaeO+BcVElNnBLc84amw=
X-Mozilla-News-Host: news://news.eternal-september.org:119