Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"I may kid around about drugs, but really, I take them seriously." -- Doctor Graper


devel / comp.lang.c / Implicit String-Literal Concatenation

SubjectAuthor
* Implicit String-Literal ConcatenationLawrence D'Oliveiro
+* Re: Implicit String-Literal ConcatenationJanis Papanagnou
|`* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
| `- Re: Implicit String-Literal Concatenationbart
+- Re: Implicit String-Literal ConcatenationBlue-Maned_Hawk
+- Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
+* Re: Implicit String-Literal ConcatenationŁukasz 'Maly' Ostrowski
|`* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
| `* Re: Implicit String-Literal ConcatenationJanis Papanagnou
|  `* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
|   `- Re: Implicit String-Literal ConcatenationJanis Papanagnou
+- Re: Implicit String-Literal ConcatenationKaz Kylheku
`* Re: Implicit String-Literal ConcatenationMike Sanders
 +* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
 |`- Re: Implicit String-Literal ConcatenationMike Sanders
 `* Re: Implicit String-Literal ConcatenationDavid Brown
  +- Re: Implicit String-Literal ConcatenationMike Sanders
  +* Re: Implicit String-Literal Concatenationbart
  |`* Re: Implicit String-Literal ConcatenationDavid Brown
  | `* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
  |  `* Re: Implicit String-Literal ConcatenationKaz Kylheku
  |   `* Re: Implicit String-Literal ConcatenationDavid Brown
  |    `* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
  |     +* Re: Implicit String-Literal Concatenationbart
  |     |`* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
  |     | `* Re: Implicit String-Literal Concatenationbart
  |     |  +* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
  |     |  |`- Re: Implicit String-Literal Concatenationbart
  |     |  `* Re: Implicit String-Literal ConcatenationScott Lurndal
  |     |   `* Re: Implicit String-Literal ConcatenationJanis Papanagnou
  |     |    `* Re: Implicit String-Literal ConcatenationScott Lurndal
  |     |     +* Re: Implicit String-Literal ConcatenationJanis Papanagnou
  |     |     |`* Re: Implicit String-Literal ConcatenationScott Lurndal
  |     |     | `* Re: Implicit String-Literal ConcatenationKeith Thompson
  |     |     |  `* Re: Implicit String-Literal Concatenationbart
  |     |     |   `* Re: Implicit String-Literal ConcatenationKeith Thompson
  |     |     |    `* Re: Implicit String-Literal ConcatenationJanis Papanagnou
  |     |     |     `* Re: Implicit String-Literal ConcatenationKeith Thompson
  |     |     |      `- Re: Implicit String-Literal ConcatenationJanis Papanagnou
  |     |     `- Re: Implicit String-Literal ConcatenationKeith Thompson
  |     `* Re: Implicit String-Literal ConcatenationDavid Brown
  |      `* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
  |       `* Re: Implicit String-Literal ConcatenationDavid Brown
  |        `* Re: Implicit String-Literal ConcatenationKaz Kylheku
  |         `- Re: Implicit String-Literal ConcatenationDavid Brown
  `* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
   +* Re: Implicit String-Literal ConcatenationKeith Thompson
   |`- Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
   `* Re: Implicit String-Literal Concatenationbart
    `* Re: Implicit String-Literal ConcatenationDavid Brown
     +* Re: Implicit String-Literal Concatenationbart
     |+- Re: Implicit String-Literal ConcatenationDavid Brown
     |+* Re: Implicit String-Literal ConcatenationKeith Thompson
     ||+* Re: Implicit String-Literal ConcatenationMalcolm McLean
     |||+* Re: Implicit String-Literal ConcatenationDavid Brown
     ||||`* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
     |||| +- Re: Implicit String-Literal ConcatenationKeith Thompson
     |||| `* Re: Implicit String-Literal ConcatenationRichard Harnden
     ||||  `- Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
     |||`- Re: Implicit String-Literal ConcatenationKeith Thompson
     ||`* Re: Implicit String-Literal Concatenationbart
     || +* Re: Implicit String-Literal ConcatenationRichard Harnden
     || |`* Re: Implicit String-Literal ConcatenationChris M. Thomasson
     || | `* Re: Implicit String-Literal ConcatenationKeith Thompson
     || |  `* Re: Implicit String-Literal ConcatenationChris M. Thomasson
     || |   `* Re: Implicit String-Literal ConcatenationKeith Thompson
     || |    +- Re: Implicit String-Literal ConcatenationChris M. Thomasson
     || |    `* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
     || |     `* Re: Implicit String-Literal ConcatenationKeith Thompson
     || |      `* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
     || |       +* Re: Implicit String-Literal ConcatenationKaz Kylheku
     || |       |`* Re: Implicit String-Literal ConcatenationKeith Thompson
     || |       | +* Re: Implicit String-Literal ConcatenationKaz Kylheku
     || |       | |`- Re: Implicit String-Literal ConcatenationKeith Thompson
     || |       | +- Re: Implicit String-Literal ConcatenationChris M. Thomasson
     || |       | `- Re: Implicit String-Literal ConcatenationRichard Harnden
     || |       `- Re: Implicit String-Literal ConcatenationKeith Thompson
     || +* Re: Implicit String-Literal ConcatenationDavid Brown
     || |`- Re: Implicit String-Literal ConcatenationKeith Thompson
     || `* Re: Implicit String-Literal ConcatenationKeith Thompson
     ||  `* Re: Implicit String-Literal ConcatenationJanis Papanagnou
     ||   `* Re: Implicit String-Literal ConcatenationKeith Thompson
     ||    `* Re: Implicit String-Literal ConcatenationKaz Kylheku
     ||     `- Re: Implicit String-Literal ConcatenationJames Kuyper
     |`- Re: Implicit String-Literal ConcatenationKeith Thompson
     `* Re: Implicit String-Literal ConcatenationKeith Thompson
      +* Re: Implicit String-Literal Concatenationbart
      |`* Re: Implicit String-Literal ConcatenationKeith Thompson
      | `* Re: Implicit String-Literal Concatenationbart
      |  +- Re: Implicit String-Literal ConcatenationKeith Thompson
      |  +* Re: Implicit String-Literal ConcatenationtTh
      |  |`- Re: Implicit String-Literal ConcatenationScott Lurndal
      |  `* Re: Implicit String-Literal ConcatenationScott Lurndal
      |   `* Re: Implicit String-Literal ConcatenationKeith Thompson
      |    `* Re: Implicit String-Literal ConcatenationScott Lurndal
      |     `* Re: Implicit String-Literal ConcatenationDavid Brown
      |      `* Re: Implicit String-Literal ConcatenationScott Lurndal
      |       +* Re: Implicit String-Literal ConcatenationScott Lurndal
      |       |`* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
      |       | `* Re: Implicit String-Literal Concatenationbart
      |       |  `* Re: Implicit String-Literal ConcatenationLawrence D'Oliveiro
      |       `- Re: Implicit String-Literal ConcatenationDavid Brown
      `* Re: Implicit String-Literal ConcatenationDavid Brown

Pages:12345
Re: Implicit String-Literal Concatenation

<urqrht$q2jt$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33955&group=comp.lang.c#33955

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!nyheter.lysator.liu.se!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 21:05:02 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <urqrht$q2jt$3@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlb8p$3bvbc$1@dont-email.me>
<urln99$3ejjt$1@dont-email.me> <urlp3h$3ep9p$5@dont-email.me>
<20240227170925.837@kylheku.com> <urn6li$3s62i$1@dont-email.me>
<uro6ls$2mh1$5@dont-email.me> <urpdfg$dl6q$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 29 Feb 2024 21:05:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="daeb6559b2144face1d3464670b018f1";
logging-data="854653"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hg3UlI9hhxg1fwSoO1DwL"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:HwvkT9Kv+gzRJa+wn67fMKCVkAg=
 by: Lawrence D'Oliv - Thu, 29 Feb 2024 21:05 UTC

On Thu, 29 Feb 2024 08:58:40 +0100, David Brown wrote:

> On 28/02/2024 21:56, Lawrence D'Oliveiro wrote:
>>
>> On Wed, 28 Feb 2024 12:50:10 +0100, David Brown wrote:
>>
>>> ... people write utilities for them in a variety of languages ...
>>>
>>> But it will often be more convenient to have it built into the
>>> language and compiler.
>>
>> What can be built into the language can only ever be a small subset of
>> the many and varied ways that people have incorporated data blobs into
>> their programs.
>
> Of course. But that doesn't mean that a language should not include a
> feature that makes it easy for a lot of people to get some data blobs
> into their code.

Maybe the C compiler should concentrate on compiling C code, and leave it
to the rest of the build toolchain to deal with other data.

Re: Implicit String-Literal Concatenation

<urqrsu$q361$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33956&group=comp.lang.c#33956

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 13:10:54 -0800
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <urqrsu$q361$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me> <87frxcuv87.fsf@nosuchdomain.example.com>
<urq4fe$lapm$1@dont-email.me> <urq7fd$lupv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 29 Feb 2024 21:10:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="499b390cf4b988af4850284edb20e870";
logging-data="855233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3Rh95g2OKOkS0OID+6Z1K8OF/TRgYyUM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:kHlTXfimK51CSs5XhvPqeqFHD0E=
In-Reply-To: <urq7fd$lupv$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 29 Feb 2024 21:10 UTC

On 2/29/2024 7:22 AM, Richard Harnden wrote:
> On 29/02/2024 14:31, bart wrote:
>> On 28/02/2024 21:36, Keith Thompson wrote:
>>> bart <bc@freeuk.com> writes:
>>> [...]
>>>> AFAIK strings in C can have embedded zeros when not assumed to be
>>>> zero-terminated. So here:
>>>>
>>>>      char s[]={1,2,3,0,4,5,6};
>>>>
>>>> s will have a length of 7.
>>>
>>> Strings *by definition* cannot have embedded zeros.  A null character
>>> terminates a string.
>>>
>>> A string literal can have embedded \0 characters, but if you're
>>> suggesting that #embed should expand to a string literal, I can see
>>> several disadvantages and no significant advantages.  For one thing, the
>>> data may or may not end with a null character; string literals always
>>> do.
>>
>> Not here:
>>
>>      char s[]  = "ABC";
>>      char t[3] = "DEF";
>>
>> The "DEF" string doesn't end with a zero.
>
> And is, therefore, not a string.
[...]

Right. However, is this a string or two embedded strings:

char x[] = "ABC\0DEF"
_____________________
#include <stdio.h>

int main()
{ char x[] = "ABC\0DEF";

printf("%s\n", x);
printf("%s", x + 4);

return 0;
} _____________________

Any undefined behavior here?

Re: Implicit String-Literal Concatenation

<87sf1brmr0.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33957&group=comp.lang.c#33957

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 13:20:19 -0800
Organization: None to speak of
Lines: 37
Message-ID: <87sf1brmr0.fsf@nosuchdomain.example.com>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlb8p$3bvbc$1@dont-email.me> <urln99$3ejjt$1@dont-email.me>
<urlp3h$3ep9p$5@dont-email.me> <20240227170925.837@kylheku.com>
<urn6li$3s62i$1@dont-email.me> <uro6ls$2mh1$5@dont-email.me>
<uro8sl$3d71$1@dont-email.me> <uroh0n$51an$2@dont-email.me>
<uroial$58n9$1@dont-email.me> <DH1EN.511038$xHn7.241242@fx14.iad>
<urq9st$mfrd$1@dont-email.me> <I62EN.21987$hN14.16206@fx17.iad>
<urqdtl$nbj3$1@dont-email.me> <sa3EN.22761$zF_1.16954@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="2beb5206cb1be4986a7eae51046cf684";
logging-data="861532"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/UUErkjTbrdML9V8wbcZ9"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:qVSwrCBz1egkBkYaqpN7wcJCrD8=
sha1:Ro+fneI3oXMQxi57YB7kbwzvuHg=
 by: Keith Thompson - Thu, 29 Feb 2024 21:20 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>On 29.02.2024 17:17, Scott Lurndal wrote:
>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>>> On 29.02.2024 16:48, Scott Lurndal wrote:
>>>>>
>>>>> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
>>>>
>>>> What does it do?
>>>>
>>>> What preconditions must be fulfilled or what additions
>>>> does it need to compile?
>>
>>With the link below I see it "needs" a 600+ lines long Makefile.
>
> The readme simply says compile it and run it
> as ./prog <value between 1 and 512>.

No, you have to compile it with specific command-line arguments to
define B and I. The Makefile does that (don't ask me why it's so long),
but you can do it manually.

From hint.txt:
"""
On a little-endian machine:

clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=6945503773712347754LL -DI=5859838231191962459LL -DT=0 -DS=7 -o prog prog.c

On a big-endian machine:

clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=7091606191627001958LL -DI=6006468689561538903LL -DT=1 -DS=0 -o prog.be prog.c
"""

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Implicit String-Literal Concatenation

<urqsso$q9h9$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33958&group=comp.lang.c#33958

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 21:27:52 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <urqsso$q9h9$3@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlgfn$3d1ah$3@dont-email.me> <urlmo7$3eg2j$1@dont-email.me>
<urn6sv$3s62i$2@dont-email.me> <877ciouua2.fsf@nosuchdomain.example.com>
<uroe02$4eoh$1@dont-email.me> <87y1b4tbcq.fsf@nosuchdomain.example.com>
<urok6t$5lv4$1@dont-email.me> <AL1EN.511040$xHn7.220429@fx14.iad>
<875xy7td2o.fsf@nosuchdomain.example.com> <593EN.22560$zF_1.19152@fx18.iad>
<urqgkq$nt9f$1@dont-email.me> <2I3EN.637365$p%Mb.40952@fx15.iad>
<QL3EN.637366$p%Mb.580728@fx15.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 29 Feb 2024 21:27:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="daeb6559b2144face1d3464670b018f1";
logging-data="861737"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/e05hOy18vRN+jBZMOt4Yl"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:udn/x5MNrf5aEHxWyHw5HFMSu5w=
 by: Lawrence D'Oliv - Thu, 29 Feb 2024 21:27 UTC

On Thu, 29 Feb 2024 18:09:52 GMT, Scott Lurndal wrote:

> I have an actual use case today where #embed of a (C++) std::map binary
> object created by separate tool would be very useful. I'm planning on
> using mmap to load it at runtime at the moment.

Why not convert it to a .o file and statically link it into your program
as part of the build process?

Re: Implicit String-Literal Concatenation

<urqtc5$q9h9$5@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33960&group=comp.lang.c#33960

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 21:36:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <urqtc5$q9h9$5@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me> <87frxcuv87.fsf@nosuchdomain.example.com>
<urprdv$gfvq$1@dont-email.me> <urq7ah$lrbn$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 29 Feb 2024 21:36:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="daeb6559b2144face1d3464670b018f1";
logging-data="861737"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dWbH79BVmwVc5NCb6A4/s"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:IaPGN6co9BoIat+Vz/MC0O8vqKo=
 by: Lawrence D'Oliv - Thu, 29 Feb 2024 21:36 UTC

On Thu, 29 Feb 2024 16:19:45 +0100, David Brown wrote:

> An array of bytes is not a "string".

It is in PHP, I think also in Perl, and also in (obsolete) Python 2.

And what about C string functions that take explicit lengths?

Re: Implicit String-Literal Concatenation

<urqtrj$qjp1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33961&group=comp.lang.c#33961

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 21:44:20 +0000
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <urqtrj$qjp1$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlb8p$3bvbc$1@dont-email.me> <urln99$3ejjt$1@dont-email.me>
<urlp3h$3ep9p$5@dont-email.me> <20240227170925.837@kylheku.com>
<urn6li$3s62i$1@dont-email.me> <uro6ls$2mh1$5@dont-email.me>
<uro8sl$3d71$1@dont-email.me> <uroh0n$51an$2@dont-email.me>
<uroial$58n9$1@dont-email.me> <DH1EN.511038$xHn7.241242@fx14.iad>
<urq9st$mfrd$1@dont-email.me> <I62EN.21987$hN14.16206@fx17.iad>
<urqdtl$nbj3$1@dont-email.me> <sa3EN.22761$zF_1.16954@fx18.iad>
<87sf1brmr0.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 29 Feb 2024 21:44:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c3e2a728c2cf8236510c608f905802b0";
logging-data="872225"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CZiW6442inYAYTxPVPpCD"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Ngo961bN9koc4aNH8ssDxKOUM9Q=
In-Reply-To: <87sf1brmr0.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: bart - Thu, 29 Feb 2024 21:44 UTC

On 29/02/2024 21:20, Keith Thompson wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>> On 29.02.2024 17:17, Scott Lurndal wrote:
>>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>>>> On 29.02.2024 16:48, Scott Lurndal wrote:
>>>>>>
>>>>>> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
>>>>>
>>>>> What does it do?
>>>>>
>>>>> What preconditions must be fulfilled or what additions
>>>>> does it need to compile?
>>>
>>> With the link below I see it "needs" a 600+ lines long Makefile.
>>
>> The readme simply says compile it and run it
>> as ./prog <value between 1 and 512>.
>
> No, you have to compile it with specific command-line arguments to
> define B and I. The Makefile does that (don't ask me why it's so long),
> but you can do it manually.
>
> From hint.txt:
> """
> On a little-endian machine:
>
> clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=6945503773712347754LL -DI=5859838231191962459LL -DT=0 -DS=7 -o prog prog.c
>
> On a big-endian machine:
>
> clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=7091606191627001958LL -DI=6006468689561538903LL -DT=1 -DS=0 -o prog.be prog.c
> """

In't it cheating when half the program is part of the build
instructions? Here is a complete standalone program:

----------------
#include <stdio.h>
#include <stdlib.h>
#define B 6945503773712347754LL
#define I 5859838231191962459LL
#define T 0
#define S 7
int main(int b,char**i){long long
n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
----------------

It's 261 bytes. The 'one-liner' that was posted was 134 bytes.

(It appears to print an input of 0 to 255 as binary.)

Re: Implicit String-Literal Concatenation

<87o7bzrll5.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33962&group=comp.lang.c#33962

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 13:45:26 -0800
Organization: None to speak of
Lines: 47
Message-ID: <87o7bzrll5.fsf@nosuchdomain.example.com>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me>
<87frxcuv87.fsf@nosuchdomain.example.com>
<urq4fe$lapm$1@dont-email.me> <urq7fd$lupv$1@dont-email.me>
<urqrsu$q361$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="2beb5206cb1be4986a7eae51046cf684";
logging-data="873237"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+8Icgfe4lhWBCQt6p/mrAH"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:vyDOdfPDQvKep/5RE80Eeq3PRBM=
sha1:gWOEY6LOs0LClVS1P1Khrmhkmd0=
 by: Keith Thompson - Thu, 29 Feb 2024 21:45 UTC

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
> On 2/29/2024 7:22 AM, Richard Harnden wrote:
>> On 29/02/2024 14:31, bart wrote:
[...]
>>> Not here:
>>>
>>>      char s[]  = "ABC";
>>>      char t[3] = "DEF";
>>>
>>> The "DEF" string doesn't end with a zero.
>> And is, therefore, not a string.
> [...]
>
> Right. However, is this a string or two embedded strings:
>
> char x[] = "ABC\0DEF"

Is *what* a string or two embedded strings?

x as a whole does not contain a string, but there are 8 strings within it.

> _____________________
> #include <stdio.h>
>
> int main()
> {
> char x[] = "ABC\0DEF";
>
> printf("%s\n", x);
> printf("%s", x + 4);
>
> return 0;
> }
> _____________________
>
> Any undefined behavior here?

No, and none in this:

for (size_t i = 0; i < sizeof x; i ++) {
printf("%s\n", x+i);
}

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Implicit String-Literal Concatenation

<87jzmnrl8f.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33963&group=comp.lang.c#33963

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 13:53:04 -0800
Organization: None to speak of
Lines: 21
Message-ID: <87jzmnrl8f.fsf@nosuchdomain.example.com>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me>
<87frxcuv87.fsf@nosuchdomain.example.com>
<urprdv$gfvq$1@dont-email.me> <urq7ah$lrbn$2@dont-email.me>
<urqtc5$q9h9$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="2beb5206cb1be4986a7eae51046cf684";
logging-data="873237"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HDhR6iUkaPTLwJsOI1JzY"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:3NAo+xlu3Dz98B7ejeWdjmBNBZA=
sha1:DLEzmw0ROe1mB1YANueirecdTwQ=
 by: Keith Thompson - Thu, 29 Feb 2024 21:53 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> On Thu, 29 Feb 2024 16:19:45 +0100, David Brown wrote:
>> An array of bytes is not a "string".
>
> It is in PHP, I think also in Perl, and also in (obsolete) Python 2.

I'm fairly sure that strings are of a distinct non-array type in all
three of those languages. If you're curious about the details, consult
the relevant documentation or post in an appropriate newsgroup.

> And what about C string functions that take explicit lengths?

What about them?

The C standard defines the term "string" (7.1.1 paragraph 1). Do you
dispute that definition?

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Implicit String-Literal Concatenation

<urquvb$qn8n$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33964&group=comp.lang.c#33964

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 14:03:23 -0800
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <urquvb$qn8n$2@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me> <87frxcuv87.fsf@nosuchdomain.example.com>
<urq4fe$lapm$1@dont-email.me> <urq7fd$lupv$1@dont-email.me>
<urqrsu$q361$1@dont-email.me> <87o7bzrll5.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 29 Feb 2024 22:03:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="499b390cf4b988af4850284edb20e870";
logging-data="875799"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7oMhNNllkMC+vPv1GVQVXU8KTWMtVSKQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:4H8ZMROkPgBY1uhOWGBrSsCIhqM=
Content-Language: en-US
In-Reply-To: <87o7bzrll5.fsf@nosuchdomain.example.com>
 by: Chris M. Thomasson - Thu, 29 Feb 2024 22:03 UTC

On 2/29/2024 1:45 PM, Keith Thompson wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 2/29/2024 7:22 AM, Richard Harnden wrote:
>>> On 29/02/2024 14:31, bart wrote:
> [...]
>>>> Not here:
>>>>
>>>>      char s[]  = "ABC";
>>>>      char t[3] = "DEF";
>>>>
>>>> The "DEF" string doesn't end with a zero.
>>> And is, therefore, not a string.
>> [...]
>>
>> Right. However, is this a string or two embedded strings:
>>
>> char x[] = "ABC\0DEF"
^^^^^^^^^^^^^^^^^^^^^

>
> Is *what* a string or two embedded strings?

For some reason, I see two "embedded" "C strings" wrt null termination here.

> x as a whole does not contain a string, but there are 8 strings within it.

Well, I was referring to that null terminator. So I see two "C strings"
separated by an offset? Wrt using std functions that terminate on a '\0'?

I think I am misunderstanding you. Sorry... ;^o

>
>> _____________________
>> #include <stdio.h>
>>
>> int main()
>> {
>> char x[] = "ABC\0DEF";
>>
>> printf("%s\n", x);
>> printf("%s", x + 4);
>>
>> return 0;
>> }
>> _____________________
>>
>> Any undefined behavior here?
>
> No, and none in this:
>
> for (size_t i = 0; i < sizeof x; i ++) {
> printf("%s\n", x+i);
> }
>

Re: Implicit String-Literal Concatenation

<87frxbrklh.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33965&group=comp.lang.c#33965

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 14:06:50 -0800
Organization: None to speak of
Lines: 27
Message-ID: <87frxbrklh.fsf@nosuchdomain.example.com>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlb8p$3bvbc$1@dont-email.me> <urln99$3ejjt$1@dont-email.me>
<urlp3h$3ep9p$5@dont-email.me> <20240227170925.837@kylheku.com>
<urn6li$3s62i$1@dont-email.me> <uro6ls$2mh1$5@dont-email.me>
<uro8sl$3d71$1@dont-email.me> <uroh0n$51an$2@dont-email.me>
<uroial$58n9$1@dont-email.me> <DH1EN.511038$xHn7.241242@fx14.iad>
<urq9st$mfrd$1@dont-email.me> <I62EN.21987$hN14.16206@fx17.iad>
<urqdtl$nbj3$1@dont-email.me> <sa3EN.22761$zF_1.16954@fx18.iad>
<87sf1brmr0.fsf@nosuchdomain.example.com>
<urqtrj$qjp1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="2beb5206cb1be4986a7eae51046cf684";
logging-data="884123"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hp6OHCYpKAZCxtuXzF/cE"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:13NPG0JLVZv9v933dna9MYEiQPw=
sha1:8/re9LY4eQqhWrXmEHaSHSpz4eo=
 by: Keith Thompson - Thu, 29 Feb 2024 22:06 UTC

bart <bc@freeuk.com> writes:
[...]
> In't it cheating when half the program is part of the build
> instructions?

Apparently not. If it were, the judges of the IOCCC would not have
accepted it.

The most recent rules are here:

https://www.ioccc.org/2020/rules.txt

I have not studied them to verify that the entry in question obeys them,
but the judges know what they're doing.

One of the winners of the 1988 contest was:
```
#include "/dev/tty"
```

This won a "Best Abuse of the Rules" award and resulted in a change in
the 1989 rules to forbid doing the same thing again.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Implicit String-Literal Concatenation

<87bk7ysysj.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33966&group=comp.lang.c#33966

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Thu, 29 Feb 2024 14:14:52 -0800
Organization: None to speak of
Lines: 73
Message-ID: <87bk7ysysj.fsf@nosuchdomain.example.com>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me>
<87frxcuv87.fsf@nosuchdomain.example.com>
<urq4fe$lapm$1@dont-email.me> <urq7fd$lupv$1@dont-email.me>
<urqrsu$q361$1@dont-email.me>
<87o7bzrll5.fsf@nosuchdomain.example.com>
<urquvb$qn8n$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="2beb5206cb1be4986a7eae51046cf684";
logging-data="884123"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yf0yn/1oWoUGvIipEqZ/4"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:bC6gUZ3yKFwxvNtT12Z+glps/Yw=
sha1:WQZ3n+Fy6ZGWb6HqIkn1fuaMIgg=
 by: Keith Thompson - Thu, 29 Feb 2024 22:14 UTC

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
> On 2/29/2024 1:45 PM, Keith Thompson wrote:
>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>> On 2/29/2024 7:22 AM, Richard Harnden wrote:
>>>> On 29/02/2024 14:31, bart wrote:
>> [...]
>>>>> Not here:
>>>>>
>>>>>      char s[]  = "ABC";
>>>>>      char t[3] = "DEF";
>>>>>
>>>>> The "DEF" string doesn't end with a zero.
>>>> And is, therefore, not a string.
>>> [...]
>>>
>>> Right. However, is this a string or two embedded strings:
>>>
>>> char x[] = "ABC\0DEF"
> ^^^^^^^^^^^^^^^^^^^^^
>
>> Is *what* a string or two embedded strings?
>
> For some reason, I see two "embedded" "C strings" wrt null termination here.

I was asking you to clarify what you're referring to. What you posted
is a declaration, not a string. You could have been referring to the
object x, to the string literal, to subsets of either, or to something else.

>> x as a whole does not contain a string, but there are 8 strings within it.
>
> Well, I was referring to that null terminator. So I see two "C
> strings" separated by an offset? Wrt using std functions that
> terminate on a '\0'?
>
> I think I am misunderstanding you. Sorry... ;^o

I thought I explained it, but here's a more straightforward explanation.
And the term "string" is defined by 7.1.1p1, not by the behavior of
standard functions: "A *string* is a contiguous sequence of characters
terminated by and including the first null character."

At run time, the array `x` contains:
- A string of length 3 starting at index 0.
- A string of length 2 starting at index 1.
- A string of length 1 starting at index 2.
- A string of length 0 starting at index 3.
- A string of length 3 starting at index 4.
- A string of length 2 starting at index 5.
- A string of length 1 starting at index 6.
- A string of length 0 starting at index 7.

#include <stdio.h>
int main(void) {
char x[] = "ABC\0DEF";
for (size_t i = 0; i < sizeof x; i ++) {
printf("x[%zu] is a pointer to the string \"%s\"\n", i, x+i);
}
}

Output:
x[0] is a pointer to the string "ABC"
x[1] is a pointer to the string "BC"
x[2] is a pointer to the string "C"
x[3] is a pointer to the string ""
x[4] is a pointer to the string "DEF"
x[5] is a pointer to the string "EF"
x[6] is a pointer to the string "F"
x[7] is a pointer to the string ""

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Implicit String-Literal Concatenation

<urs2s0$14t0k$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33969&group=comp.lang.c#33969

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 09:16:00 +0100
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <urs2s0$14t0k$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlb8p$3bvbc$1@dont-email.me>
<urln99$3ejjt$1@dont-email.me> <urlp3h$3ep9p$5@dont-email.me>
<20240227170925.837@kylheku.com> <urn6li$3s62i$1@dont-email.me>
<uro6ls$2mh1$5@dont-email.me> <urpdfg$dl6q$1@dont-email.me>
<urqrht$q2jt$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 08:16:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5c5e819273d939ae1d3ad0d1a529b09a";
logging-data="1209364"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QvIqWB+qVQu7zCVgkdu6tAw9C1tEORf0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:kOaZRzhwMyTSnY9MF0EcbwvzyZs=
In-Reply-To: <urqrht$q2jt$3@dont-email.me>
Content-Language: en-GB
 by: David Brown - Fri, 1 Mar 2024 08:16 UTC

On 29/02/2024 22:05, Lawrence D'Oliveiro wrote:
> On Thu, 29 Feb 2024 08:58:40 +0100, David Brown wrote:
>
>> On 28/02/2024 21:56, Lawrence D'Oliveiro wrote:
>>>
>>> On Wed, 28 Feb 2024 12:50:10 +0100, David Brown wrote:
>>>
>>>> ... people write utilities for them in a variety of languages ...
>>>>
>>>> But it will often be more convenient to have it built into the
>>>> language and compiler.
>>>
>>> What can be built into the language can only ever be a small subset of
>>> the many and varied ways that people have incorporated data blobs into
>>> their programs.
>>
>> Of course. But that doesn't mean that a language should not include a
>> feature that makes it easy for a lot of people to get some data blobs
>> into their code.
>
> Maybe the C compiler should concentrate on compiling C code, and leave it
> to the rest of the build toolchain to deal with other data.

It is possible to be actively involved in the development of the
standards - preparing and discussing proposals, joining committees, or
at least joining mailing lists for the discussions. If you are not
doing the work and showing the interest /before/ decisions are made, you
don't get a say afterwards. It is more productive to discuss what you
can do with the features C has, than to wish it never had them.

Oh, and the reason C23 has #embed, is because people want it. It is
something C developers have asked for for many years. /You/ might not
have use of it, but that's true of lots of features of C for all
programmers - no one needs everything in the language and standard library.

Re: Implicit String-Literal Concatenation

<ursfhg$17dak$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33970&group=comp.lang.c#33970

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 11:52:16 +0000
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <ursfhg$17dak$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlgfn$3d1ah$3@dont-email.me> <urlmo7$3eg2j$1@dont-email.me>
<urn6sv$3s62i$2@dont-email.me> <877ciouua2.fsf@nosuchdomain.example.com>
<uroe02$4eoh$1@dont-email.me> <87y1b4tbcq.fsf@nosuchdomain.example.com>
<urok6t$5lv4$1@dont-email.me> <AL1EN.511040$xHn7.220429@fx14.iad>
<875xy7td2o.fsf@nosuchdomain.example.com> <593EN.22560$zF_1.19152@fx18.iad>
<urqgkq$nt9f$1@dont-email.me> <2I3EN.637365$p%Mb.40952@fx15.iad>
<QL3EN.637366$p%Mb.580728@fx15.iad> <urqsso$q9h9$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 11:52:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="48547281e0ea2b9e8e390eb976b0300b";
logging-data="1291604"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+RRGkN7KGx04zTW3VDV5Vs"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:PNu45rxPaVsVf9HQX4QTYLFqByc=
Content-Language: en-GB
In-Reply-To: <urqsso$q9h9$3@dont-email.me>
 by: bart - Fri, 1 Mar 2024 11:52 UTC

On 29/02/2024 21:27, Lawrence D'Oliveiro wrote:
> On Thu, 29 Feb 2024 18:09:52 GMT, Scott Lurndal wrote:
>
>> I have an actual use case today where #embed of a (C++) std::map binary
>> object created by separate tool would be very useful. I'm planning on
>> using mmap to load it at runtime at the moment.
>
> Why not convert it to a .o file and statically link it into your program
> as part of the build process?

That's exactly what #embed will enable.

Re: Implicit String-Literal Concatenation

<ursftp$17dak$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33971&group=comp.lang.c#33971

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 11:58:49 +0000
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <ursftp$17dak$2@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<877ciouua2.fsf@nosuchdomain.example.com> <urphlj$ejuu$1@dont-email.me>
<urpllc$ff02$1@dont-email.me> <urq860$2ntv$2@news.gegeweb.eu>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 1 Mar 2024 11:58:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="48547281e0ea2b9e8e390eb976b0300b";
logging-data="1291604"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XDHEeaCiyzY79HlkVIsyV"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:cZGYnJQqSkwtT34yrmHkPm2Dg08=
In-Reply-To: <urq860$2ntv$2@news.gegeweb.eu>
Content-Language: en-GB
 by: bart - Fri, 1 Mar 2024 11:58 UTC

On 29/02/2024 15:34, tTh wrote:
> On 2/29/24 11:18, bart wrote:
>> Using 'strinclude' in my old C compiler, it took about 1 second to
>> build this program:
>>
>>    #include <stdio.h>
>>    #include <string.h>
>>
>>    char* s=strinclude("data");
>>
>>    int main(void) {
>>       printf("%zu\n", strlen(s));
>>   }
>
> tth@redlady:~/Desktop$ man strinclude
> No manual entry for strinclude
> tth@redlady:~/Desktop$
>

'strinclude' is an extension I made for that compiler.

#embed is the new feature of C23. Although I'm not sure how it would be
used to initialise a char* pointer. Perhaps like this:

char dummy[] {
#embed "data"
,0};
char* s = dummy;

(I've added a 0-terminator here; I don't know if #embed will take care
of that.)

My 'strinclude' produces a zero-terminated string, but it is done within
the parser rather than lexer.

Re: Implicit String-Literal Concatenation

<ursgvt$17n29$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33972&group=comp.lang.c#33972

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 13:17:01 +0100
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <ursgvt$17n29$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<877ciouua2.fsf@nosuchdomain.example.com> <urphlj$ejuu$1@dont-email.me>
<urpllc$ff02$1@dont-email.me> <urq860$2ntv$2@news.gegeweb.eu>
<ursftp$17dak$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 1 Mar 2024 12:17:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5c5e819273d939ae1d3ad0d1a529b09a";
logging-data="1301577"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19R3uijIXijW46IaiG4ZapHbvnqiAj3L7c="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:jdwijixOw4rzarcnS4gQ9ud1v/I=
In-Reply-To: <ursftp$17dak$2@dont-email.me>
Content-Language: en-GB
 by: David Brown - Fri, 1 Mar 2024 12:17 UTC

On 01/03/2024 12:58, bart wrote:
> On 29/02/2024 15:34, tTh wrote:
>> On 2/29/24 11:18, bart wrote:
>>> Using 'strinclude' in my old C compiler, it took about 1 second to
>>> build this program:
>>>
>>>    #include <stdio.h>
>>>    #include <string.h>
>>>
>>>    char* s=strinclude("data");
>>>
>>>    int main(void) {
>>>       printf("%zu\n", strlen(s));
>>>   }
>>
>> tth@redlady:~/Desktop$ man strinclude
>> No manual entry for strinclude
>> tth@redlady:~/Desktop$
>>
>
> 'strinclude' is an extension I made for that compiler.
>
> #embed is the new feature of C23. Although I'm not sure how it would be
> used to initialise a char* pointer. Perhaps like this:
>
>     char dummy[]  {
>     #embed "data"
>     ,0};
>     char* s = dummy;
>
> (I've added a 0-terminator here; I don't know if #embed will take care
> of that.)

#embed very specifically does not add anything. So you would do :

const char s[] = {
#embed "data" suffix(,)
0
};

The "suffix" parameter adds a comma if "data" is not empty, and does
nothing if "data" is empty. Writing it as you did would work fine for
non-empty "data" but give the nonsensical results {,0} if "data" is
empty. (You might not care about such cases and prefer to write the
simpler version, but now you also know about "suffix".)

There is no need to have a separate character pointer variable - the
const char array can be used directly in most circumstances.

>
> My 'strinclude' produces a zero-terminated string, but it is done within
> the parser rather than lexer.

Re: Implicit String-Literal Concatenation

<ursjfu$185qe$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33973&group=comp.lang.c#33973

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: richard....@gmail.invalid (Richard Harnden)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 12:59:43 +0000
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <ursjfu$185qe$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me> <87frxcuv87.fsf@nosuchdomain.example.com>
<urprdv$gfvq$1@dont-email.me> <urq7ah$lrbn$2@dont-email.me>
<urqtc5$q9h9$5@dont-email.me>
Reply-To: richard.harnden@invalid.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 12:59:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="eec3bfff1813b0f5e507487beb40fdbc";
logging-data="1316686"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vUEkYNS5+qeBfxduUuiqcZFTIifipKbk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TVxg4PmoPcvJ/iaeA2uDbafyLyc=
Content-Language: en-GB
In-Reply-To: <urqtc5$q9h9$5@dont-email.me>
 by: Richard Harnden - Fri, 1 Mar 2024 12:59 UTC

On 29/02/2024 21:36, Lawrence D'Oliveiro wrote:
> On Thu, 29 Feb 2024 16:19:45 +0100, David Brown wrote:
>
>> An array of bytes is not a "string".
>
> It is in PHP, I think also in Perl, and also in (obsolete) Python 2.
>
> And what about C string functions that take explicit lengths?

You mean: There's a danger that a function that returns a 'string', but
truncates it to n chars, might not be returning a string at all ?

Re: Implicit String-Literal Concatenation

<20240301085504.767@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33980&group=comp.lang.c#33980

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 16:55:51 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <20240301085504.767@kylheku.com>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlb8p$3bvbc$1@dont-email.me>
<urln99$3ejjt$1@dont-email.me> <urlp3h$3ep9p$5@dont-email.me>
<20240227170925.837@kylheku.com> <urn6li$3s62i$1@dont-email.me>
<uro6ls$2mh1$5@dont-email.me> <urpdfg$dl6q$1@dont-email.me>
<urqrht$q2jt$3@dont-email.me> <urs2s0$14t0k$1@dont-email.me>
Injection-Date: Fri, 1 Mar 2024 16:55:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="24c55e5273c316a14a1eea66477d3f37";
logging-data="1416034"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ziiu9+pR510sy29sMA04lQ5YoM0nlYRU="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:f7/so3gYNHzE/u89wEiKcu+/HmA=
 by: Kaz Kylheku - Fri, 1 Mar 2024 16:55 UTC

On 2024-03-01, David Brown <david.brown@hesbynett.no> wrote:
> It is possible to be actively involved in the development of the
> standards - preparing and discussing proposals, joining committees, or
> at least joining mailing lists for the discussions. If you are not
> doing the work and showing the interest /before/ decisions are made, you
> don't get a say afterwards. It is more productive to discuss what you
> can do with the features C has, than to wish it never had them.

Also, if you don't join the gang that breaks windows and spray
paints walls, you don't get to say aftward which windows are broken
and what is scribbled on what wall.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Implicit String-Literal Concatenation

<urt23j$1bdeo$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33982&group=comp.lang.c#33982

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 18:09:05 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <urt23j$1bdeo$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlb8p$3bvbc$1@dont-email.me> <urln99$3ejjt$1@dont-email.me>
<urlp3h$3ep9p$5@dont-email.me> <20240227170925.837@kylheku.com>
<urn6li$3s62i$1@dont-email.me> <uro6ls$2mh1$5@dont-email.me>
<uro8sl$3d71$1@dont-email.me> <uroh0n$51an$2@dont-email.me>
<uroial$58n9$1@dont-email.me> <DH1EN.511038$xHn7.241242@fx14.iad>
<urq9st$mfrd$1@dont-email.me> <I62EN.21987$hN14.16206@fx17.iad>
<urqdtl$nbj3$1@dont-email.me> <sa3EN.22761$zF_1.16954@fx18.iad>
<87sf1brmr0.fsf@nosuchdomain.example.com> <urqtrj$qjp1$1@dont-email.me>
<87frxbrklh.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 17:09:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="573b6f3271b5f86b0906bbb1ccc77221";
logging-data="1422808"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4XSYyS6c0/LO41m0IiOqU"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:EqKxnf8g8ArooOjJhycU7SFGAHg=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <87frxbrklh.fsf@nosuchdomain.example.com>
 by: Janis Papanagnou - Fri, 1 Mar 2024 17:09 UTC

On 29.02.2024 23:06, Keith Thompson wrote:
> bart <bc@freeuk.com> writes:
> [...]
>> In't it cheating when half the program is part of the build
>> instructions?

I recall from decades ago (when I looked into this contest) that they
even had a contribution that fed the whole C program into the compiler
through compiler options. (I think it even got a prize.)

"Is it cheating?" - I'd say no, since it was accepted.

Is it really about an "obfuscated C code"? - I'd say no. (But it was
anyway a curiosity.)

>
> Apparently not. If it were, the judges of the IOCCC would not have
> accepted it.
> [...]
>
> One of the winners of the 1988 contest was:
> ```
> #include "/dev/tty"

This is great! :-)

Janis

Re: Implicit String-Literal Concatenation

<urt375$1bhic$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33985&group=comp.lang.c#33985

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 18:28:05 +0100
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <urt375$1bhic$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlb8p$3bvbc$1@dont-email.me>
<urln99$3ejjt$1@dont-email.me> <urlp3h$3ep9p$5@dont-email.me>
<20240227170925.837@kylheku.com> <urn6li$3s62i$1@dont-email.me>
<uro6ls$2mh1$5@dont-email.me> <urpdfg$dl6q$1@dont-email.me>
<urqrht$q2jt$3@dont-email.me> <urs2s0$14t0k$1@dont-email.me>
<20240301085504.767@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 17:28:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5c5e819273d939ae1d3ad0d1a529b09a";
logging-data="1427020"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6l52XLS3unZt4SvIRwELXxNteKBIYoek="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:KcrNOvN9PTomQ0kakZisrn+4I+U=
In-Reply-To: <20240301085504.767@kylheku.com>
Content-Language: en-GB
 by: David Brown - Fri, 1 Mar 2024 17:28 UTC

On 01/03/2024 17:55, Kaz Kylheku wrote:
> On 2024-03-01, David Brown <david.brown@hesbynett.no> wrote:
>> It is possible to be actively involved in the development of the
>> standards - preparing and discussing proposals, joining committees, or
>> at least joining mailing lists for the discussions. If you are not
>> doing the work and showing the interest /before/ decisions are made, you
>> don't get a say afterwards. It is more productive to discuss what you
>> can do with the features C has, than to wish it never had them.
>
> Also, if you don't join the gang that breaks windows and spray
> paints walls, you don't get to say aftward which windows are broken
> and what is scribbled on what wall.
>

A slightly closer version of that feeble analogy would be that you don't
get to say they should have used a different colour, or broken doors
instead of windows.

It's okay for Lawrence (or anyone else) to say that don't approve of
#embed, or don't think they will use it themselves. But like most
(probably all) features in newer C standards, it was added because
enough people wanted it for the committee and connected developers to do
the work designing and documenting the features, and testing prototypes
in practice.

There are procedures in place for people to have an influence on the
future of C. If you want to have your say, you can have it. But
waiting until a new standard version is solidified and then complaining
that you don't like the direction it is taking, is too late. Whining
about things here afterwards doesn't do anyone any good.

That's different from saying you don't like the feature, or you don't
like the way C is heading, or you won't use it yourself. And it's
different from talking about it, trying to learn how a new feature works
and how to make the best of it. Such discussions are great, and I'd
love to see more of them here in c.l.c.

Re: Implicit String-Literal Concatenation

<87y1b1rdmd.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33987&group=comp.lang.c#33987

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 01 Mar 2024 10:49:46 -0800
Organization: None to speak of
Lines: 29
Message-ID: <87y1b1rdmd.fsf@nosuchdomain.example.com>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlb8p$3bvbc$1@dont-email.me> <urln99$3ejjt$1@dont-email.me>
<urlp3h$3ep9p$5@dont-email.me> <20240227170925.837@kylheku.com>
<urn6li$3s62i$1@dont-email.me> <uro6ls$2mh1$5@dont-email.me>
<uro8sl$3d71$1@dont-email.me> <uroh0n$51an$2@dont-email.me>
<uroial$58n9$1@dont-email.me> <DH1EN.511038$xHn7.241242@fx14.iad>
<urq9st$mfrd$1@dont-email.me> <I62EN.21987$hN14.16206@fx17.iad>
<urqdtl$nbj3$1@dont-email.me> <sa3EN.22761$zF_1.16954@fx18.iad>
<87sf1brmr0.fsf@nosuchdomain.example.com>
<urqtrj$qjp1$1@dont-email.me>
<87frxbrklh.fsf@nosuchdomain.example.com>
<urt23j$1bdeo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="2cc05af7b21c575849b4d760831db7cf";
logging-data="1466668"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DzC9LtZZYdUo2XNTHHd1c"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:8d+Mvr7WoT/tmkjB8LRIZNS99d4=
sha1:WeI/gYKI21tn32Wcd8Vw3MOZKNM=
 by: Keith Thompson - Fri, 1 Mar 2024 18:49 UTC

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 29.02.2024 23:06, Keith Thompson wrote:
>> bart <bc@freeuk.com> writes:
>> [...]
>>> In't it cheating when half the program is part of the build
>>> instructions?
>
> I recall from decades ago (when I looked into this contest) that they
> even had a contribution that fed the whole C program into the compiler
> through compiler options. (I think it even got a prize.)

1990/stig.c:
```
c ```

stig.ksh provides a ksh alias that compiles it with a long "-D..."
option. (The resulting program prints a message indicating whether the
compiler supports nested /**/ comments.)

Like most Abuse of the Rules winners, it resulted in a rule change for
the following years.

https://www.ioccc.org/years.html#1990

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Implicit String-Literal Concatenation

<urtfiv$1e8g0$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33989&group=comp.lang.c#33989

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 20:59:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <urtfiv$1e8g0$2@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me> <87frxcuv87.fsf@nosuchdomain.example.com>
<urprdv$gfvq$1@dont-email.me> <urq7ah$lrbn$2@dont-email.me>
<urqtc5$q9h9$5@dont-email.me> <ursjfu$185qe$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 1 Mar 2024 20:59:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="08fcff3ec016520633046216dcf0e434";
logging-data="1516032"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gmfLDMJdjtF9uYkXdxC6T"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:x90MH9tdYuVxG940w28Hkd16Wyk=
 by: Lawrence D'Oliv - Fri, 1 Mar 2024 20:59 UTC

On Fri, 1 Mar 2024 12:59:43 +0000, Richard Harnden wrote:

> You mean: There's a danger that a function that returns a 'string', but
> truncates it to n chars, might not be returning a string at all ?

If it’s not NUL-terminated, then it’s not a “string”, right?

Re: Implicit String-Literal Concatenation

<urtfvr$1eg6j$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33991&group=comp.lang.c#33991

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Fri, 1 Mar 2024 22:06:03 +0100
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <urtfvr$1eg6j$2@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlb8p$3bvbc$1@dont-email.me> <urln99$3ejjt$1@dont-email.me>
<urlp3h$3ep9p$5@dont-email.me> <20240227170925.837@kylheku.com>
<urn6li$3s62i$1@dont-email.me> <uro6ls$2mh1$5@dont-email.me>
<uro8sl$3d71$1@dont-email.me> <uroh0n$51an$2@dont-email.me>
<uroial$58n9$1@dont-email.me> <DH1EN.511038$xHn7.241242@fx14.iad>
<urq9st$mfrd$1@dont-email.me> <I62EN.21987$hN14.16206@fx17.iad>
<urqdtl$nbj3$1@dont-email.me> <sa3EN.22761$zF_1.16954@fx18.iad>
<87sf1brmr0.fsf@nosuchdomain.example.com> <urqtrj$qjp1$1@dont-email.me>
<87frxbrklh.fsf@nosuchdomain.example.com> <urt23j$1bdeo$1@dont-email.me>
<87y1b1rdmd.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 21:06:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d63b5913b208007a66e59d1f1c95c79a";
logging-data="1523923"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hKz6ddJc0icRYbckUd8mb"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:9xRyNm8zppMqmE7V0+iAe7LYr4E=
In-Reply-To: <87y1b1rdmd.fsf@nosuchdomain.example.com>
 by: Janis Papanagnou - Fri, 1 Mar 2024 21:06 UTC

On 01.03.2024 19:49, Keith Thompson wrote:
>
> Like most Abuse of the Rules winners, it resulted in a rule change for
> the following years.

Makes sense.

Janis

Re: Implicit String-Literal Concatenation

<us06s4$235d9$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34006&group=comp.lang.c#34006

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Sat, 2 Mar 2024 13:48:52 -0800
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <us06s4$235d9$1@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me> <87frxcuv87.fsf@nosuchdomain.example.com>
<urq4fe$lapm$1@dont-email.me> <urq7fd$lupv$1@dont-email.me>
<urqrsu$q361$1@dont-email.me> <87o7bzrll5.fsf@nosuchdomain.example.com>
<urquvb$qn8n$2@dont-email.me> <87bk7ysysj.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 2 Mar 2024 21:48:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="071be47e219b7469dee2c582d4081a62";
logging-data="2201001"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MOVp3i2r9A5lw1N0KElDAfp2mtY3q4co="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:OARPfhGG5rCnVPCnDXyBKj13whA=
In-Reply-To: <87bk7ysysj.fsf@nosuchdomain.example.com>
Content-Language: en-US
 by: Chris M. Thomasson - Sat, 2 Mar 2024 21:48 UTC

On 2/29/2024 2:14 PM, Keith Thompson wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 2/29/2024 1:45 PM, Keith Thompson wrote:
>>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>>> On 2/29/2024 7:22 AM, Richard Harnden wrote:
>>>>> On 29/02/2024 14:31, bart wrote:
>>> [...]
>>>>>> Not here:
>>>>>>
>>>>>>      char s[]  = "ABC";
>>>>>>      char t[3] = "DEF";
>>>>>>
>>>>>> The "DEF" string doesn't end with a zero.
>>>>> And is, therefore, not a string.
>>>> [...]
>>>>
>>>> Right. However, is this a string or two embedded strings:
>>>>
>>>> char x[] = "ABC\0DEF"
>> ^^^^^^^^^^^^^^^^^^^^^
>>
>>> Is *what* a string or two embedded strings?
>>
>> For some reason, I see two "embedded" "C strings" wrt null termination here.
>
> I was asking you to clarify what you're referring to. What you posted
> is a declaration, not a string. You could have been referring to the
> object x, to the string literal, to subsets of either, or to something else.
>
>>> x as a whole does not contain a string, but there are 8 strings within it.
>>
>> Well, I was referring to that null terminator. So I see two "C
>> strings" separated by an offset? Wrt using std functions that
>> terminate on a '\0'?
>>
>> I think I am misunderstanding you. Sorry... ;^o
>
> I thought I explained it, but here's a more straightforward explanation.
> And the term "string" is defined by 7.1.1p1, not by the behavior of
> standard functions: "A *string* is a contiguous sequence of characters
> terminated by and including the first null character."
[...]

Ahhh yes. Sorry for glossing over that point.

Re: Implicit String-Literal Concatenation

<us684m$3jpc3$4@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34124&group=comp.lang.c#34124

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Tue, 5 Mar 2024 04:47:18 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <us684m$3jpc3$4@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urk6um$33nqv$1@dont-email.me>
<urlgfn$3d1ah$3@dont-email.me> <urlmo7$3eg2j$1@dont-email.me>
<urn6sv$3s62i$2@dont-email.me> <877ciouua2.fsf@nosuchdomain.example.com>
<uroe02$4eoh$1@dont-email.me> <87y1b4tbcq.fsf@nosuchdomain.example.com>
<urok6t$5lv4$1@dont-email.me> <AL1EN.511040$xHn7.220429@fx14.iad>
<875xy7td2o.fsf@nosuchdomain.example.com> <593EN.22560$zF_1.19152@fx18.iad>
<urqgkq$nt9f$1@dont-email.me> <2I3EN.637365$p%Mb.40952@fx15.iad>
<QL3EN.637366$p%Mb.580728@fx15.iad> <urqsso$q9h9$3@dont-email.me>
<ursfhg$17dak$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 5 Mar 2024 04:47:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a1a7f9c36865f1bff757c845ff7d3ffd";
logging-data="3794307"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+r/MoKSTdZdUZnjkxBsRYz"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:WLqXyjkdb4xNHMg2yByX7duyEl8=
 by: Lawrence D'Oliv - Tue, 5 Mar 2024 04:47 UTC

On Fri, 1 Mar 2024 11:52:16 +0000, bart wrote:

> On 29/02/2024 21:27, Lawrence D'Oliveiro wrote:
>
>> On Thu, 29 Feb 2024 18:09:52 GMT, Scott Lurndal wrote:
>>
>>> I have an actual use case today where #embed of a (C++) std::map
>>> binary object created by separate tool would be very useful. I'm
>>> planning on using mmap to load it at runtime at the moment.
>>
>> Why not convert it to a .o file and statically link it into your
>> program as part of the build process?
>
> That's exactly what #embed will enable.

You can call it a toy version of objcopy
<https://manpages.debian.org/1/objcopy.1.html>.

Re: Implicit String-Literal Concatenation

<us6876$3jpc3$5@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34125&group=comp.lang.c#34125

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Implicit String-Literal Concatenation
Date: Tue, 5 Mar 2024 04:48:38 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <us6876$3jpc3$5@dont-email.me>
References: <urdsob$1e8e4$7@dont-email.me> <urj1qv$2p32o$1@dont-email.me>
<urk6um$33nqv$1@dont-email.me> <urlgfn$3d1ah$3@dont-email.me>
<urlmo7$3eg2j$1@dont-email.me> <urn6sv$3s62i$2@dont-email.me>
<urnbh6$3t14d$1@dont-email.me> <87frxcuv87.fsf@nosuchdomain.example.com>
<urq4fe$lapm$1@dont-email.me> <urq7fd$lupv$1@dont-email.me>
<urqrsu$q361$1@dont-email.me> <87o7bzrll5.fsf@nosuchdomain.example.com>
<urquvb$qn8n$2@dont-email.me> <87bk7ysysj.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 5 Mar 2024 04:48:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a1a7f9c36865f1bff757c845ff7d3ffd";
logging-data="3794307"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CyoFL0jE4vjvGPI8acXqn"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:2RY3bNelLZp8aYKPyeGb2lPJpWc=
 by: Lawrence D'Oliv - Tue, 5 Mar 2024 04:48 UTC

On Thu, 29 Feb 2024 14:14:52 -0800, Keith Thompson wrote:

> "A *string* is a contiguous sequence of characters
> terminated by and including the first null character."

So how come strlen(3) does not include the null?


devel / comp.lang.c / Implicit String-Literal Concatenation

Pages:12345
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor