🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #191

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

#191
From: fir
Date: Sun, 11 Oct 2026 08:57
52 lines
2794 bytes
fir pisze:

> 
> #include <string.h>
> #include <stdint.h>
> 
> static const char tag1[16] __attribute__((aligned(4))) = "addasD";
> static const char tag2[16] __attribute__((aligned(4))) = "addasD";
> static const char tag3[16] __attribute__((aligned(4))) = "addasE";
> 
> 
> 
> static inline int tag_eq(const char *a,const char *b)
> {
>      if(a==b) return 1;
> 
>      const uint32_t *x=(const uint32_t *)a;
>      const uint32_t *y=(const uint32_t *)b;
> 
>      return x[0]==y[0] && x[1]==y[1] && x[2]==y[2] && x[3]==y[3];
> }
> 


sorry the above part should be deleted the below is  ok and i not 
noticed this above was in post

> 
> not tested it though but it should be ok probably (if work)
> 
> typedef const char tag20[20] __attribute__((aligned(4)));
> 
> //tag20 z="test";
> 
> static inline int tag20_eq(tag20 a,tag20 b)
> {
>      if(a==b) return 1;
>      const uint32_t *x=(const uint32_t *)a;
>      const uint32_t *y=(const uint32_t *)b;
>      return x[0]==y[0] && x[1]==y[1] && x[2]==y[2] && x[3]==y[3] && 
> x[4]==y[4];
> }
> 
> 
> 
> it compiled but i not tested it
> 
> overally it seems either first or second solution are real so i could 
> take one
> 
> 
Technical Details
Message-ID: <11afj2m$2fqv3$2@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> <9tyyS.21373$VDn8.13923@fx14.ams4> <11afcku$2dli3$1@dont-email.me> <11afe36$2e577$1@dont-email.me> <11afe6j$2e577$2@dont-email.me> <11afedm$2e577$3@dont-email.me> <11aff4q$2egej$1@dont-email.me> <11afiss$2fqv3$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: fir <profesor.fir@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: compare literals / if( "cat"== "dog") {}
Date: Sun, 11 Oct 2026 10:57:57 +0200
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <11afj2m$2fqv3$2@dont-email.me>
References: <11ae962$2365v$1@dont-email.me> <9tyyS.21373$VDn8.13923@fx14.ams4>
 <11afcku$2dli3$1@dont-email.me> <11afe36$2e577$1@dont-email.me>
 <11afe6j$2e577$2@dont-email.me> <11afedm$2e577$3@dont-email.me>
 <11aff4q$2egej$1@dont-email.me> <11afiss$2fqv3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 11 Oct 2026 08:57:58 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2616291"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/Av1eQly/L6XrxR0UXcLqGavlGT38xHCY="; posting-host="c78a7ee27a315dc33fa20d18f85fce92"
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:5cprXws221n0pMrEKn+3WEJ5SpY= sha256:h9Y8P0R9TUrH0LEO+Ml5JgYnSrgms5jDB5ddVNTCp6g=
	sha1:lBJ+ayrHHm4Q2PMvcL3dOLaSB8s= sha256:L9ICL135v1oytLmLx+K5hfN/+ctox69ENn2pUylgnGE=
In-Reply-To: <11afiss$2fqv3$1@dont-email.me>