🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #415

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

#415
From: Rosario19
Date: Thu, 15 Oct 2026 09:36
37 lines
2367 bytes
On Sat, 10 Oct 2026 23:02:54 +0200, fir 
>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 say if int is 4 chars this should return 1 in case of fist line
0 in case the second line

if((*(int*)"cat") == (*(int*)"cat")) return 1
if((*(int*)"cat") == (*(int*)"dog") ) return 0

otherwise there is a need one function that from the pointer check
strings are ugual as strcmp

I think can be too 
strcpy(char* a, char* b)
{
 if(a==b) return 0;

}

but who is sure a and b point a to 2 strings?

>i probably asked that but if so once again
>
>is there way to enforce it to work?
Technical Details
Message-ID: <6171dlho2h59l01e1jvp6so5cbddc5brct@4ax.com>
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>

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: Rosario19 <Ros@invalid.invalid>
Newsgroups: comp.lang.c
Subject: Re: compare literals / if( "cat"== "dog") {}
Date: Thu, 15 Oct 2026 11:36:34 +0200
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <6171dlho2h59l01e1jvp6so5cbddc5brct@4ax.com>
References: <11ae962$2365v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 15 Oct 2026 09:28:50 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2385623"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18DTtSG5XHAgM1g58i/Bj8pSTlQQV3Mwlc="; posting-host="eb8dd47cc9aad624043fd4a339e1b3ac"
Cancel-Lock: sha1:WLolBGU96fRjjI8QKKBJEMVlbjs= sha256:WU8MOrIo1l2y4/qQnijECILxeiPkKjxamnZfKyVjkZI=
	sha1:8KPZOSCCDKc5tUDdpIbfAWQzblU= sha256:YOi7UbnVXv789A/XZibgVjN5uTXhRy20JtBnnhjVzeY=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)