Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"You need tender loving care once a week - so that I can slap you into shape." -- Ellyn Mustard


devel / comp.lang.c / Re: you think rust may outthrone c?

SubjectAuthor
* you think rust may outthrone c?fir
+* you think rust may outthrone c?Ben Bacarisse
|`* you think rust may outthrone c?Bart
| `* you think rust may outthrone c?Ben Bacarisse
|  `* you think rust may outthrone c?Bart
|   +- you think rust may outthrone c?Ben Bacarisse
|   +- you think rust may outthrone c?Ben Bacarisse
|   `* you think rust may outthrone c?Keith Thompson
|    `* you think rust may outthrone c?Bart
|     `* you think rust may outthrone c?Keith Thompson
|      `* you think rust may outthrone c?Bart
|       `* you think rust may outthrone c?Keith Thompson
|        `* you think rust may outthrone c?Bart
|         `* you think rust may outthrone c?Keith Thompson
|          `* you think rust may outthrone c?Bart
|           +* you think rust may outthrone c?Richard Damon
|           |+- you think rust may outthrone c?Malcolm McLean
|           |`* you think rust may outthrone c?Bart
|           | `* you think rust may outthrone c?Ben Bacarisse
|           |  +* you think rust may outthrone c?Malcolm McLean
|           |  |+* you think rust may outthrone c?Ben Bacarisse
|           |  ||+* you think rust may outthrone c?Malcolm McLean
|           |  |||`- you think rust may outthrone c?Ben Bacarisse
|           |  ||`* Making accountants cross (wa Re: you think rust may outthrone c?)Vir Campestris
|           |  || +- Making accountants cross (wa Re: you think rust may outthrone c?)Ben Bacarisse
|           |  || +- Making accountants cross (wa Re: you think rust may outthrone c?)Bart
|           |  || `* Making accountants cross (wa Re: you think rust may outthrone c?)Kaz Kylheku
|           |  ||  `* Making accountants cross (wa Re: you think rust may outthroneLew Pitcher
|           |  ||   +- Making accountants cross (wa Re: you think rust may outthrone c?)Chris M. Thomasson
|           |  ||   `* Making accountants cross (wa Re: you think rust may outthrone c?)Kaz Kylheku
|           |  ||    `- Making accountants cross (wa Re: you think rust may outthrone c?)Chris M. Thomasson
|           |  |`- you think rust may outthrone c?David Brown
|           |  +* you think rust may outthrone c?Bart
|           |  |+* you think rust may outthrone c?Kaz Kylheku
|           |  ||+- you think rust may outthrone c?Ben Bacarisse
|           |  ||`* you think rust may outthrone c?Bart
|           |  || `* you think rust may outthrone c?Richard Damon
|           |  ||  `* you think rust may outthrone c?Bart
|           |  ||   +* you think rust may outthrone c?Malcolm McLean
|           |  ||   |`- you think rust may outthrone c?Keith Thompson
|           |  ||   +* you think rust may outthrone c?Richard Damon
|           |  ||   |`* you think rust may outthrone c?Bart
|           |  ||   | +* you think rust may outthrone c?Michael S
|           |  ||   | |`- you think rust may outthrone c?Bart
|           |  ||   | `* you think rust may outthrone c?Richard Damon
|           |  ||   |  +* you think rust may outthrone c?Bart
|           |  ||   |  |`- you think rust may outthrone c?Bart
|           |  ||   |  `- you think rust may outthrone c?Michael S
|           |  ||   +- you think rust may *DE*throne c?Scott Lurndal
|           |  ||   +* you think rust may outthrone c?Michael S
|           |  ||   |`- you think rust may outthrone c?Bart
|           |  ||   `- you think rust may outthrone c?Keith Thompson
|           |  |+* you think rust may outthrone c?Keith Thompson
|           |  ||`* you think rust may outthrone c?Bart
|           |  || `- you think rust may outthrone c?Keith Thompson
|           |  |`- you think rust may outthrone c?Ben Bacarisse
|           |  `* you think rust may outthrone c?Tim Rentsch
|           |   `* you think rust may outthrone c?Ben Bacarisse
|           |    `* you think rust may outthrone c?Tim Rentsch
|           |     `* you think rust may outthrone c?Ben Bacarisse
|           |      `- you think rust may outthrone c?Tim Rentsch
|           +* you think rust may outthrone c?Kaz Kylheku
|           |`* you think rust may outthrone c?James Kuyper
|           | +- you think rust may outthrone c?Malcolm McLean
|           | `- you think rust may outthrone c?Richard Damon
|           `* you think rust may outthrone c?Keith Thompson
|            `* you think rust may outthrone c?Bart
|             `* you think rust may outthrone c?Keith Thompson
|              `* you think rust may outthrone c?Bart
|               +- you think rust may outthrone c?Richard Damon
|               `* you think rust may outthrone c?Keith Thompson
|                `* you think rust may outthrone c?Bart
|                 `* you think rust may outthrone c?Kaz Kylheku
|                  `* you think rust may outthrone c?Bart
|                   `* you think rust may outthrone c?Kaz Kylheku
|                    `- you think rust may outthrone c?Michael S
+* you think rust may outthrone c?Bart
|+- you think rust may outthrone c?Kaz Kylheku
|+* you think rust may outthrone c?Richard Damon
||+- you think rust may outthrone c?Bart
||`* you think rust may outthrone c?David Brown
|| `* you think rust may outthrone c?Bart
||  `* you think rust may outthrone c?Kaz Kylheku
||   `- you think rust may outthrone c?Bart
|+* you think rust may outthrone c?David Brown
||+- you think rust may outthrone c?Malcolm McLean
||`* you think rust may outthrone c?Bart
|| +* you think rust may outthrone c?Kaz Kylheku
|| |`- you think rust may outthrone c?Richard Damon
|| `- you think rust may outthrone c?David Brown
|`* you think rust may outthrone c?Tim Rentsch
| `* you think rust may outthrone c?Bart
|  +* you think rust may outthrone c?David Brown
|  |`* you think rust may outthrone c?Malcolm McLean
|  | `* you think rust may outthrone c?David Brown
|  |  `- you think rust may outthrone c?Malcolm McLean
|  `- you think rust may outthrone c?Kaz Kylheku
+* you think rust may outthrone c?David Brown
|`* you think rust may outthrone c?Malcolm McLean
| `* you think rust may outthrone c?David Brown
|  +- you think rust may outthrone c?Bart
|  `* you think rust may outthrone c?Malcolm McLean
+* you think rust may outthrone c?Bart
+* you think rust may outthrone c?Bart
+- you think rust may outthrone c?David Brown
`* you think rust may outthrone c?Blue-Maned_Hawk

Pages:123456789101112131415161718192021222324252627282930313233343536373839
Re: you think rust may outthrone c?

<uaujc2$3jbrq$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36491&group=comp.lang.c#36491

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 9 Aug 2023 00:33:24 +0100
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <uaujc2$3jbrq$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uag05n$nmu5$1@dont-email.me> <uagcgc$ppbn$1@dont-email.me>
<87fs50ulog.fsf@bsb.me.uk> <uagpni$rt71$1@dont-email.me>
<87r0ohrvg0.fsf@bsb.me.uk> <uamlh1$1tr9i$1@dont-email.me>
<875y5tkptn.fsf@bsb.me.uk> <uans1e$26toe$1@dont-email.me>
<87cyzzkfxh.fsf@nosuchdomain.example.com> <uap5e6$2gd8e$1@dont-email.me>
<87350vke4n.fsf@nosuchdomain.example.com> <uap73l$2gktp$1@dont-email.me>
<87y1initxx.fsf@nosuchdomain.example.com> <uapf90$2ht0t$1@dont-email.me>
<87leenirja.fsf@nosuchdomain.example.com> <uaqdst$2q82c$1@dont-email.me>
<87leemseod.fsf@nosuchdomain.example.com> <uas0k1$32e8o$2@dont-email.me>
<877cq6s60y.fsf@nosuchdomain.example.com> <uat5n4$3c1rg$1@dont-email.me>
<87v8dpqk2x.fsf@nosuchdomain.example.com> <uauf1m$3iofh$2@dont-email.me>
<20230808155150.344@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 8 Aug 2023 23:33:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a3e3f2cca54b4449b08be290b6883e55";
logging-data="3780474"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GEUE1bgFaf/Cctxq94z2bxSXbOGrxzGI="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:41emlGimUWQ/6qH2sIBxRJxOg/4=
In-Reply-To: <20230808155150.344@kylheku.com>
 by: Bart - Tue, 8 Aug 2023 23:33 UTC

On 08/08/2023 23:58, Kaz Kylheku wrote:
> On 2023-08-08, Bart <bc@freeuk.com> wrote:
>> On 08/08/2023 22:51, Keith Thompson wrote:
>>> Bart <bc@freeuk.com> writes:
>>>> On 08/08/2023 01:59, Keith Thompson wrote:
>>> [...]
>>>>> bcc is your implementation, right?
>>>>
>>>> It's my compiler, but it uses msvcrt.dll to do the print. tcc uses the
>>>> same library with the same output. Both seem to use a default of 6
>>>> places after the ".", whether hex or decimal.
>>> [SNIP]
>>>
>>> To summarize, your implementation (bcc) uses msvcrt.dll to provide
>>> the implementation of the printf function, and that implementation
>>> implements "%a" and "%A", but does so incorrectly. That's a bug in
>>> that particular version of msvcrt.dll (and in your implementation).
>>>
>>> (The output is likely enough to distinguish between adjacent
>>> floating-point values (I haven't verified that), but not enough to
>>> represent the value exactly, which is what the standard requires.)
>>
>> This is actually something I hadn't considered. If the purpose of %A is
>> a 100% accurate representation of the whole number, then those 7 digits
>> shown by msvcrt.dll are not enough, and it is wrong.
>
> MSVCRT.DLL is a system library you're not supposed to use.

And yet, nearly every other program uses it. Including gcc.exe of mingw:

Entry: 168014
Lookup RVA: 168290
Time Date Stamp: 0
Fwd Chain: 0
Name RVA: 169B14
Name: msvcrt.dll <------------------------
Import Addr RVA: 1688D0
Import:16929C 38 __C_specific_handler
Import:1692B4 40 ___lc_codepage_func
Import:1692CA 43 ___mb_cur_max_func
Import:1692E0 52 __getmainargs
....

And tcc.exe. And every program compiled with that gcc imports
msvcrt.dll, even if it uses its own libraries too.

They can't get rid of it because too many things would stop working.

Re: you think rust may outthrone c?

<20230808164841.541@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36495&group=comp.lang.c#36495

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 8 Aug 2023 23:50:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <20230808164841.541@kylheku.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uag05n$nmu5$1@dont-email.me> <uagcgc$ppbn$1@dont-email.me>
<87fs50ulog.fsf@bsb.me.uk> <uagpni$rt71$1@dont-email.me>
<87r0ohrvg0.fsf@bsb.me.uk> <uamlh1$1tr9i$1@dont-email.me>
<875y5tkptn.fsf@bsb.me.uk> <uans1e$26toe$1@dont-email.me>
<87cyzzkfxh.fsf@nosuchdomain.example.com> <uap5e6$2gd8e$1@dont-email.me>
<87350vke4n.fsf@nosuchdomain.example.com> <uap73l$2gktp$1@dont-email.me>
<87y1initxx.fsf@nosuchdomain.example.com> <uapf90$2ht0t$1@dont-email.me>
<87leenirja.fsf@nosuchdomain.example.com> <uaqdst$2q82c$1@dont-email.me>
<87leemseod.fsf@nosuchdomain.example.com> <uas0k1$32e8o$2@dont-email.me>
<877cq6s60y.fsf@nosuchdomain.example.com> <uat5n4$3c1rg$1@dont-email.me>
<87v8dpqk2x.fsf@nosuchdomain.example.com> <uauf1m$3iofh$2@dont-email.me>
<20230808155150.344@kylheku.com> <uaujc2$3jbrq$1@dont-email.me>
Injection-Date: Tue, 8 Aug 2023 23:50:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d6295b22c3d59b763dd1a159df959743";
logging-data="3782201"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/qWIVOuxvWh4OKNBfCqDDMcg4Zi8umF68="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:BWBY4LgLZB2O01AiTWOJ0XVs3+U=
 by: Kaz Kylheku - Tue, 8 Aug 2023 23:50 UTC

On 2023-08-08, Bart <bc@freeuk.com> wrote:
> On 08/08/2023 23:58, Kaz Kylheku wrote:
> > On 2023-08-08, Bart <bc@freeuk.com> wrote:
> >> On 08/08/2023 22:51, Keith Thompson wrote:
> >>> Bart <bc@freeuk.com> writes:
> >>>> On 08/08/2023 01:59, Keith Thompson wrote:
> >>> [...]
> >>>>> bcc is your implementation, right?
> >>>>
> >>>> It's my compiler, but it uses msvcrt.dll to do the print. tcc uses the
> >>>> same library with the same output. Both seem to use a default of 6
> >>>> places after the ".", whether hex or decimal.
> >>> [SNIP]
> >>>
> >>> To summarize, your implementation (bcc) uses msvcrt.dll to provide
> >>> the implementation of the printf function, and that implementation
> >>> implements "%a" and "%A", but does so incorrectly. That's a bug in
> >>> that particular version of msvcrt.dll (and in your implementation).
> >>>
> >>> (The output is likely enough to distinguish between adjacent
> >>> floating-point values (I haven't verified that), but not enough to
> >>> represent the value exactly, which is what the standard requires.)
> >>
> >> This is actually something I hadn't considered. If the purpose of %A is
> >> a 100% accurate representation of the whole number, then those 7 digits
> >> shown by msvcrt.dll are not enough, and it is wrong.
> >
> > MSVCRT.DLL is a system library you're not supposed to use.
>
> And yet, nearly every other program uses it. Including gcc.exe of mingw:

Yes; by doing that, they are perpetrating a poor practice.

It's a good reason to stay away from the MinGW project.

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

Re: you think rust may outthrone c?

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

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36496&group=comp.lang.c#36496

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 08 Aug 2023 16:51:07 -0700
Organization: None to speak of
Lines: 27
Message-ID: <87ttt9ozys.fsf@nosuchdomain.example.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<d124c512-5586-444e-9252-72e601502eaen@googlegroups.com>
<uaddgc$1lf7$1@dont-email.me>
<d7fcd0d6-c5a5-4229-87d5-98f3129c9572n@googlegroups.com>
<87wmydv39y.fsf@bsb.me.uk>
<c707dddd-c94e-47bf-9ae6-a8537d245ac1n@googlegroups.com>
<uaeivj$9urb$1@dont-email.me>
<27a833dc-67b7-4195-a3f5-8d8c60ad3d2fn@googlegroups.com>
<uafsqe$mtv7$1@dont-email.me> <X=vUTZgAAVQwBn6et@bongo-ra.co>
<uaj4gk$1alq7$1@dont-email.me>
<cbe7d004-e90b-41d7-9a34-c711ef9c3949n@googlegroups.com>
<uaj7iv$1b5h7$1@dont-email.me>
<2caab55a-f70e-457f-a4d2-ee912c27b681n@googlegroups.com>
<ualceb$1nnq7$1@dont-email.me>
<1aceef78-a719-424e-9234-63bc7531105cn@googlegroups.com>
<uatmcb$3eti9$1@dont-email.me>
<a33ce226-3826-4b0c-97fc-585105018304n@googlegroups.com>
<uatrg9$3fncp$1@dont-email.me>
<2eb60e6c-5f68-40fb-afef-c41ca8bb3683n@googlegroups.com>
<uaufeh$3iq7v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="913a52d54f1fb8cef77698b79d9b2607";
logging-data="3774181"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ia8jUaBWMDsOKmiTb4NEq"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:gPIamVMCqbs1tnQOXFdbnSe65dw=
sha1:ko/7daaBWxc2xHth7GdlGWCqIkQ=
 by: Keith Thompson - Tue, 8 Aug 2023 23:51 UTC

David Brown <david.brown@hesbynett.no> writes:
[...]
> That is a hopeless attitude to take. You are simply guaranteeing that
> people will not use it for internationalisation - or that they will
> hate the tool when they try to use it. Targeting hobby users is not
> an excuse for bad design. I would suggest you remove all traces of
> internationalisation until you have found a way to make it work. (And
> drop the XML format while you are at it - a simple one line, one
> command text format would be vastly easier for everyone.)
[...]

If you're going to do internationalization, I suggest using some
standard format to store the messages.

GNU gettext uses a plain-text ".po" format.

There's also an ISO standard format called XLIFF which is, for
better or worse, XML-based.
https://en.wikipedia.org/wiki/XLIFF

XLIFF is probably used widely enough that there are tools that let
users treat the XML files as opaque binaries.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: you think rust may outthrone c?

<nBAAM.23838$Wk53.3572@fx01.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36497&group=comp.lang.c#36497

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx01.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: you think rust may outthrone c?
Newsgroups: comp.lang.c
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com> <uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me> <uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me> <uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me> <uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me> <uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me> <uatlrr$3epln$1@dont-email.me> <87il9pqhj7.fsf@nosuchdomain.example.com> <uauiad$3j7ed$1@dont-email.me>
Lines: 16
Message-ID: <nBAAM.23838$Wk53.3572@fx01.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 08 Aug 2023 23:54:59 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 08 Aug 2023 23:54:59 GMT
X-Received-Bytes: 1512
 by: Scott Lurndal - Tue, 8 Aug 2023 23:54 UTC

Bart <bc@freeuk.com> writes:
>
>You know, I'd like to see what a bare gcc installation looks like, as I
>don't think I've seen one yet!
>
snip

>(Let me guess: it will have no system headers, no assembler, and no
>linker. You then start to question exactly what 'gcc' is, and what it
>can do.)

You can download the sources yourself, if you like.

https://gcc.gnu.org/gcc-13/

It is rather easy to build.

Re: you think rust may outthrone c?

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

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36498&group=comp.lang.c#36498

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 08 Aug 2023 16:57:52 -0700
Organization: None to speak of
Lines: 52
Message-ID: <87pm3xoznj.fsf@nosuchdomain.example.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u9rnnv$1iftl$1@dont-email.me> <WNdwM.224816$GMN3.36273@fx16.iad>
<u9s1v2$1jhg7$1@dont-email.me> <u9tko8$1s9cs$1@dont-email.me>
<u9trgp$1stmg$1@dont-email.me> <u9u040$1tbdh$1@dont-email.me>
<u9u5cd$1tqc9$1@dont-email.me> <uaavm0$3ln4f$1@dont-email.me>
<uab5ja$3mc91$1@dont-email.me> <uabeq1$3nigh$1@dont-email.me>
<uabobj$3oias$1@dont-email.me> <uaduf0$54pp$1@dont-email.me>
<uajaqg$1bc41$4@dont-email.me> <uajfq3$1cesi$1@dont-email.me>
<uat7t4$3cco6$1@dont-email.me> <uat9ca$3cjmt$1@dont-email.me>
<uatjcp$3ec7b$1@dont-email.me> <uatlrr$3epln$1@dont-email.me>
<87il9pqhj7.fsf@nosuchdomain.example.com>
<uauiad$3j7ed$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="913a52d54f1fb8cef77698b79d9b2607";
logging-data="3774181"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19MkHxgl4PiHSQJkI8pY3rc"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:XnCTkvLTW2NpT5LHGUbL7FHc8gc=
sha1:X9hkgmMHVc+dnlgEMGLcpsidpNo=
 by: Keith Thompson - Tue, 8 Aug 2023 23:57 UTC

Bart <bc@freeuk.com> writes:
> On 08/08/2023 23:46, Keith Thompson wrote:
>> Bart <bc@freeuk.com> writes:
>> [...]
>>> gcc 13.2 comes with make.exe, so they learnt something! (I wonder at
>>> what point they decided that actually providing 'make.exe' was a good
>>> idea?)
>>
>> No, gcc 13.2 does not come with make.exe. gcc and make are separate
>> packages.
>>
>> Who exactly are "they"? (I think I know who you're referring to.
>> I think you do too. What I'm curious about is why you chose to
>> omit that piece of information.)
>
> You know, I'd like to see what a bare gcc installation looks like, as
> I don't think I've seen one yet!

Because gcc by itself is not useful. It's part of a C implemention.

But you know that.

> As they can be anything up to 1GB.
>
> (Let me guess: it will have no system headers, no assembler, and no
> linker. You then start to question exactly what 'gcc' is, and what it
> can do.)

Those are good questions to ask. Some of us have tried to answer them
for you, but you don't listen.

> The 13.2 version I think might be from this page:
> https://www.mingw-w64.org/downloads/

Ok. I thought you were using TDM-GCC. In any case, if you think that
that page just provides gcc then you haven't read it:

The heart of the Mingw-w64 project is headers and support libraries
to run the output of GCC on Windows. Since Mingw-w64 is neither the
home of GCC nor of binutils, several sets of installation packages
which combine them are available.

[...]

> This is to demonstrate that C implementations can exist in different forms.

I'm surprised that you admit that.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: you think rust may outthrone c?

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

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36499&group=comp.lang.c#36499

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 08 Aug 2023 17:52:56 -0700
Organization: None to speak of
Lines: 25
Message-ID: <87leelox3r.fsf@nosuchdomain.example.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me>
<87il9pqhj7.fsf@nosuchdomain.example.com>
<uauiad$3j7ed$1@dont-email.me> <nBAAM.23838$Wk53.3572@fx01.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="913a52d54f1fb8cef77698b79d9b2607";
logging-data="3800070"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ELuTzOZA1bpRZ6zv9zNeE"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:unyoc+n3ohG4TeDaBzT8PbiCGlc=
sha1:axyz7fDhPkzIzAs2sjBGGsqk56o=
 by: Keith Thompson - Wed, 9 Aug 2023 00:52 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
> Bart <bc@freeuk.com> writes:
>>
>>You know, I'd like to see what a bare gcc installation looks like, as I
>>don't think I've seen one yet!
>>
> snip
>
>>(Let me guess: it will have no system headers, no assembler, and no
>>linker. You then start to question exactly what 'gcc' is, and what it
>>can do.)
>
> You can download the sources yourself, if you like.
>
> https://gcc.gnu.org/gcc-13/
>
> It is rather easy to build.

It's fairly easy to build on Unix-like systems; less so on Windows
without some Unix-like emulation layer.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: you think rust may outthrone c?

<87bkfhggnn.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36500&group=comp.lang.c#36500

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 09 Aug 2023 02:15:24 +0100
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <87bkfhggnn.fsf@bsb.me.uk>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<u9rcgd$1h7l5$1@dont-email.me> <WRawM.202896$TPw2.151582@fx17.iad>
<u9rnnv$1iftl$1@dont-email.me> <WNdwM.224816$GMN3.36273@fx16.iad>
<u9s1v2$1jhg7$1@dont-email.me> <u9tko8$1s9cs$1@dont-email.me>
<u9trgp$1stmg$1@dont-email.me> <u9u040$1tbdh$1@dont-email.me>
<u9u5cd$1tqc9$1@dont-email.me> <uaavm0$3ln4f$1@dont-email.me>
<uab5ja$3mc91$1@dont-email.me> <uabeq1$3nigh$1@dont-email.me>
<uabobj$3oias$1@dont-email.me> <uaduf0$54pp$1@dont-email.me>
<uajaqg$1bc41$4@dont-email.me> <uajfq3$1cesi$1@dont-email.me>
<uat7t4$3cco6$1@dont-email.me>
<44ca14e8-6fa7-44ff-811d-b598171a9302n@googlegroups.com>
<871qgdiool.fsf@bsb.me.uk>
<220063cb-d1cb-4c3e-a127-c8f08acf7b9bn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="8fcde280a269416e5c30c74acd76122c";
logging-data="3805275"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PpwGKN7vsrw5AzYNp9HCRatbpLRdwuNw="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:7d9yEijSNxrHDSse3tkuv6DrJMw=
sha1:ZTSc2+tXRzBBcLbdkpUK8P+nDuM=
X-BSB-Auth: 1.d2c3deef0366c4204b1b.20230809021524BST.87bkfhggnn.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 9 Aug 2023 01:15 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

> On Tuesday, 8 August 2023 at 15:39:21 UTC+1, Ben Bacarisse wrote:
>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>>
>> > I used CMake for the Baby X resource compiler. It worked on Windows
>> > and Mac. But it broke on Linux when Ben tested it.
>> Maybe you were able to conclude that, but I only reported compile
>> errors. That may have been the fault of CMake, but you never said what
>> the problem was, only to say that "linux" included <stdint.h>.
>>
> The MP3 decoder included a few standard headers, then typedefed
> types like uint8_t, to match <stdint.h>. It works fine on Windows and Mac
> because the standard headers don't define those types.

What do you really mean here? It can't be what you wrote. Windows and
Mac don't define those types but then /no/ OS defines them. OSes don't
define C types. A C implementation will provide a header that defines
them, but they will be defined only if the program includes that header.
There are C implementation for Windows and Mac that provide <stdint.h>.
I would be surprised if the implementation you are using on Windows and
on Mac don't.

> But on Linux,
> they obviously include <stdint.h>, whch I believe they are allowed to
> do, and so the code broke.

Who is "they"? Originally you said that Linux included the file, which
was obviously a shorthand for something, but I could not tell what. I
remember asking at the time. You didn't say.

One reading is that "they" are the authors of the MP3 decoder. By that
reading, "they" have broken code because it both defines the types and
includes <stdint.h>. That seems unlikely though.

--
Ben.

Re: you think rust may outthrone c?

<uauppe$3k5gt$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36501&group=comp.lang.c#36501

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 9 Aug 2023 02:22:54 +0100
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <uauppe$3k5gt$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me> <87il9pqhj7.fsf@nosuchdomain.example.com>
<uauiad$3j7ed$1@dont-email.me> <nBAAM.23838$Wk53.3572@fx01.iad>
<87leelox3r.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 9 Aug 2023 01:22:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a3e3f2cca54b4449b08be290b6883e55";
logging-data="3806749"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/enU19L38BamBqbVIwLeeiPSFBQQ5uRIs="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:nWSTDeeCddoWmmTjyZseYWOcqBM=
In-Reply-To: <87leelox3r.fsf@nosuchdomain.example.com>
 by: Bart - Wed, 9 Aug 2023 01:22 UTC

On 09/08/2023 01:52, Keith Thompson wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>> Bart <bc@freeuk.com> writes:
>>>
>>> You know, I'd like to see what a bare gcc installation looks like, as I
>>> don't think I've seen one yet!
>>>
>> snip
>>
>>> (Let me guess: it will have no system headers, no assembler, and no
>>> linker. You then start to question exactly what 'gcc' is, and what it
>>> can do.)
>>
>> You can download the sources yourself, if you like.
>>
>> https://gcc.gnu.org/gcc-13/
>>
>> It is rather easy to build.
>
> It's fairly easy to build on Unix-like systems; less so on Windows
> without some Unix-like emulation layer.

That link is not very specific. I ended up here as the nearest thing
that looked like sources:

https://mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-13.2.0/

I downloaded one of these. There were 124,000 files across 5400 folders,
totalling 700MB.

Other than 75,000 .h and .c files, there were 100s of files with
extensions .cpp, .hpp, .py, .m4 and .awk among many others.

I think Scott was having a laugh when he said it was easy to build. I
wouldn't a clue where to start.

But I also don't believe these are the sources code to the basic gcc
compiler, unless the basic compiler is 500MB.

This was a good exercise however, it reminded me of why I do what I do.

The sources for my C compiler /and/ standard headers /plus/ my windows.h
can be represented as one 1.2MB file in one folder. It can be compiled
to an executable in 0.09 seconds.

(I'd like to know what you guys consider hard to build.)

Re: you think rust may outthrone c?

<875y5pgfag.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36502&group=comp.lang.c#36502

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 09 Aug 2023 02:44:55 +0100
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <875y5pgfag.fsf@bsb.me.uk>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<87fs50ulog.fsf@bsb.me.uk> <uagpni$rt71$1@dont-email.me>
<87r0ohrvg0.fsf@bsb.me.uk> <uamlh1$1tr9i$1@dont-email.me>
<875y5tkptn.fsf@bsb.me.uk> <uans1e$26toe$1@dont-email.me>
<87cyzzkfxh.fsf@nosuchdomain.example.com>
<uap5e6$2gd8e$1@dont-email.me>
<87350vke4n.fsf@nosuchdomain.example.com>
<uap73l$2gktp$1@dont-email.me>
<87y1initxx.fsf@nosuchdomain.example.com>
<uapf90$2ht0t$1@dont-email.me>
<87leenirja.fsf@nosuchdomain.example.com>
<uaqdst$2q82c$1@dont-email.me> <8M4AM.510037$TPw2.337804@fx17.iad>
<uaqqou$2sa5t$1@dont-email.me> <87wmy6j37n.fsf@bsb.me.uk>
<86a5v1brhz.fsf@linuxsc.com> <87v8dph9ac.fsf@bsb.me.uk>
<865y5pbl7q.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="8fcde280a269416e5c30c74acd76122c";
logging-data="3933480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BUaIznBgp9Vg+l0MCBLZ0qCSJPw9INGM="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:dz2SPVYLse0o0SRXANOYYENJKmA=
sha1:S8ox6Fw7InloHYhMsbrpKuMJuCw=
X-BSB-Auth: 1.32b34eb914868d4db542.20230809024455BST.875y5pgfag.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 9 Aug 2023 01:44 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>
>>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>>
>>>> Bart <bc@freeuk.com> writes:
>>>>
>>>>> The problem with the hex-binary form of C is that the representation
>>>>> of the significant figures varies according to exponent.
>>>>
>>>> No necessarily. An implementation can choose to be consistent. In
>>>> fact, it would take some effort not to be consistent in this regard.
>>>> Different implementation may choose different representations of the
>>>> same number, but for a single implementation I would expect the
>>>> digits to be the same regardless of the exponent.
>>>
>>> I understand what you're saying here, and agree with it.
>>>
>>> However, there is a subtle point that deserves mentioning. If a
>>> 'double' value is printed using %a, and the same value is
>>> converted to a 'long double' and printed using %La, in most cases
>>> the digits (and exponents) of the outputs will be different.
>>
>> That does indeed happen in the libc printf I'm using. I am almost
>> tempted to look at the code to see why that is done. Maybe there is an
>> obvious reason for it, but I can't think of one off the top of my head.
>
> It happens because of the formats of double and long double. For
> most non-zero values (and not inf or NaN), a double has 52 bits
> of significand plus an implied '1' at the top, giving 53 bits
> overall. Converting to long double gives 64 bits of significand
> only now the high-order '1' is explicit (ie, 64 bits overall).
> So double has one bit for the leading digit (always 1) plus 13
> groups of four bits, whereas long double has four bits for the
> leading digit (always between 8 and F) plus 15 groups of four
> bits.

I'd forgotten that Intel long doubles use bit 63 explicitly. So you are
saying it's just for simplicity -- just dump the nibbles. You make it
sound almost inevitable, but compatible output, with a leading "0x1.",
could have been generated. However, there's a lot of sense in just
dumping the nibbles. For one thing, you get the hex values you'd see
for if you were to examine memory in a debugger.

> If you see a %a output whose leading digit is between 8 and F,
> probably what was done is the double value was converted to a
> long double, so the long double value could just be funneled
> through the code for the long double case.

I was wondering why an implementation would do that. Of course, you
then loose the advantage of getting the hex digits you'd see in memory.

--
Ben.

Re: you think rust may outthrone c?

<rpCAM.87315$ftCb.76427@fx34.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36503&group=comp.lang.c#36503

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx34.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: you think rust may outthrone c?
Newsgroups: comp.lang.c
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaeul9$b81t$1@dont-email.me> <87r0okvrht.fsf@bsb.me.uk>
<uag05n$nmu5$1@dont-email.me> <uagcgc$ppbn$1@dont-email.me>
<87fs50ulog.fsf@bsb.me.uk> <uagpni$rt71$1@dont-email.me>
<87r0ohrvg0.fsf@bsb.me.uk> <uamlh1$1tr9i$1@dont-email.me>
<875y5tkptn.fsf@bsb.me.uk> <uans1e$26toe$1@dont-email.me>
<87cyzzkfxh.fsf@nosuchdomain.example.com> <uap5e6$2gd8e$1@dont-email.me>
<87350vke4n.fsf@nosuchdomain.example.com> <uap73l$2gktp$1@dont-email.me>
<87y1initxx.fsf@nosuchdomain.example.com> <uapf90$2ht0t$1@dont-email.me>
<87leenirja.fsf@nosuchdomain.example.com> <uaqdst$2q82c$1@dont-email.me>
<8M4AM.510037$TPw2.337804@fx17.iad> <uaqqou$2sa5t$1@dont-email.me>
<87wmy6j37n.fsf@bsb.me.uk> <uara1m$2uq73$1@dont-email.me>
<20230807125815.939@kylheku.com> <uas273$32k64$1@dont-email.me>
<2FhAM.351580$xMqa.250758@fx12.iad> <uat7ht$3camf$1@dont-email.me>
<qsqAM.133251$f7Ub.122358@fx47.iad> <uatimv$3e73n$1@dont-email.me>
From: Richard@Damon-Family.org (Richard Damon)
Content-Language: en-US
In-Reply-To: <uatimv$3e73n$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 231
Message-ID: <rpCAM.87315$ftCb.76427@fx34.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Tue, 8 Aug 2023 21:58:47 -0400
X-Received-Bytes: 10061
 by: Richard Damon - Wed, 9 Aug 2023 01:58 UTC

On 8/8/23 10:16 AM, Bart wrote:
> On 08/08/2023 13:22, Richard Damon wrote:
> > On 8/8/23 7:05 AM, Bart wrote:
> >> On 08/08/2023 03:21, Richard Damon wrote:
> >>  > On 8/7/23 8:28 PM, Bart wrote:
> >>  >> My view is that C's print-format system is not fit for purpose. The
> >>  >> formatting is OK, it is needing to specify types that is the
> problem.
> >>  >
> >>  > which is EXACTLY the arguement that got us the C++ stream <<
> operator.
> >> That feature is so bad it makes using printf preferable! Is it really
> >> that hard to just be able to write 'print x' ?
> >>
> >>  > If you want to do that in C, you can, just define a generic "print"
> >>  > function that defines version for each fundamental type, and call
> >> that.
> >>  >
> >>  > You don't seem to understand that C is based on the assumption that
> >> the
> >>  > programmer actually knows what he is doing, not hiding behind a
> >> mass of
> >>  > abstractions.
> >>
> >> You don't get my point. The programmer might not know for sure the
> >> type of a complex expression, and certainly does not want to keep
> >> updating dozens of printf formats across the codebase as global
> >> declarations change.
> >
> > Then they are using the wrong tool.
>
> What tool did you have in mind? Do you mean that an IDE will tell you
> the types of the expressions, or write the format codes for you?

IF you actually want to output expressions that you don't know the type,
you need something that supports that. Maybe C++, maybe Python, maybe
something else like that.

It seems you have one tool in your box, so everything is a nail.

>
> That strikes me as the same argument that you can use CDECL to get round
> abstruse C type specs. If the tool can do it, why doesn't the compiler?
> Or the language.

Except the issue you are describing isn't handled by CDECL. That
generally needs the fully expressed type, and you complaint seems to be
a type that has been hidden via typedefs and the like.

So CDECL doesn't do what you want.

>
> > C is designed to be used when you know, at least in general, what you
> > are working with.
> >
> >>
> >> Right now I don't know how to print a clock() result for example, and
> >> to keep inventing special formats like %zu is crass.
> >>
> >> *I* can just write:
> >>
> >>      println a, b, c
> >
> > So, why don't you?
>
> I do. It's lovely. The question is, why are a million users of C denied
> that?

Because that isn't C. If you want basic, you know where to find it.

Note, "println" like that can't do a lot of things that printf can do
when properly used, so it becomes the problem of just using the right tool.

>
> > is the problem that you don't know how to translate that into C?
> >
> >>
> >> So can a dozen other languages (even from the 1960s!). I can change
> >> the types of a, b, c, and it still works. I can print c, b, a and it
> >> still works.
> >>
> >> I can even just do 'print clock()'!
> >>
> >> In C YOU CAN'T DO THAT. You need to dig up the types of each
> >> expression and apply the right format. In this VERY simple case, it
> >> MIGHT be:
> >
> > Because C is a lower level, and targeted to be more efficiet, than those
> > other languages.
>
> Sorry, but that is rubbish. My 'M' language is also low level, but
> somehow manages to have a proper print. And it's not dead slow either:

And I bet it only runs on x86 processors?

>
> A loop which prints the numbers up to 10 million (redirected to a file
> to remove display overheads), takes 1.8 seconds in my language, and 3.2
> seconds using gcc 13.2 -O3. bcc/tcc take 2.4 seconds.
>
> (My library is faster, despite the int->text code being unoptimised,
> because of buffering. But then maybe gcc's printf is also buffered
> internally. Which one is cheating more? I know mine won in this case!)

Maybe you used the wrong C library to do that.

Also, since you have shown that you format routines don't meet the full
functionality of C's, that will give it an advantage.

>
>
> >>
> >>      printf("%lld " PRId64 " %s", a, b, c);
> >>
> >> But now you have an extra maintenance headache.
> >>
> >> (In all cases, printing gets untidy when you need to do necessary
> >> formatting, but only C incorporates types into the formatting.)
> >>
> >>
> >>  >> It gets tricky when using sprintf say from another language,
> which is
> >>  >> then transpiled to actual C.
> >>  >
> >>  > And why doesn't that other language implement a better print
> >>  > functionality itself?
> >>
> >> It does, but ultimately it needs to do I/O, and I've been using C's
> >> printf for that since the mid-90s, because it was simpler than using
> >> WinAPI. I've since forgotten how do it with WinAPI.
> >
> > So, your problem is that you aren't willing to do the work yourself.
>
> What problem is this? I've been implementing 'proper' PRINT in languages
> since as far back as 1981.

Then why are you complaining that the C printf doesn't meet your
requireents?

>
> At some point, nearly 20 years later, I switched from OS to C functions
> for low-level I/O, for consoles or files. For Printing to printers,
> images, windows and strings, I still handled that.

So?

You added a layer of abstraction, so maybe you programs can run on more
targets.

>
> > So again, the problem is you are using the wrong tool or your language
> > is incomplete.
>
> The problem is that you don't have a clue what the problem is.

No, I fully understand it.

>
> There is no tool, and no feature in my language (other than turning it
> into C), that will fix the problem that C's 'char*' is so unique.

Why is C's char* being unique a problem?

It still sounds like the problem is you don't understand what C is
doing, so you are misusing it.

>
> Usually you can ignore that if using C's library purely via a binary
> interface, but if generating C code, you will see issues. The solutions
> are ugly and ungainly.

But "intermediary" output is almost always "ugly", that is part of the
nature of machine generated code. If you "compilation" is any good, no
one needs to look at it.

>
> Try it and see!
>
> > But to use C as a portable assembler, you need to use it as an
> > assembler, and that means understanding the nature of the "assembly
> > language".
>
> An assembly language which has a million more rules, special cases  and
> UBs than any real assembler!

Your thinking about the wrong machine. Remember, in C, the machine you
need to be thinking about is the "abstract machine" defined by the standard.

>
> In x64 assembly, I can write a floating point value to a 64-bit memory
> location, and read it back as an integer, with no issues:
>
>      movq [fred], xmm0
>      mov rax, [fred]
>
> C makes that undefined - maybe.

So?

>
> > IF you are concerned about efficient outputing of valuse, you build a
> > family of generic "print" functions that use the right version for the
> > type given, and let the complier figure it out. Just means you can't put
> > everything in one statement. (but this is intermediary code, so doesn't
> > really need to be totally readable).
>
> This is exactly what I do behind the scenes of my language. And another
> reason why I sometimes use 'printf', since it produces long sequences of
> function calls which obscure minimal test code.
>
> The advantage of printf also is that it is outside my language, so its
> implementation code doesn't intrude.
>

And if the doesn't meet your requirements, don't use it.

One big aspect of printf, is you need to know the "type" of each
arguement you give it. If you do, it works well, if you don't you just
can't use it.

You seem to think this is a bug instead of its design decision.


Click here to read the complete article
Re: you think rust may outthrone c?

<875y5potwq.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36504&group=comp.lang.c#36504

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Tue, 08 Aug 2023 19:01:57 -0700
Organization: None to speak of
Lines: 19
Message-ID: <875y5potwq.fsf@nosuchdomain.example.com>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me>
<87il9pqhj7.fsf@nosuchdomain.example.com>
<uauiad$3j7ed$1@dont-email.me> <nBAAM.23838$Wk53.3572@fx01.iad>
<87leelox3r.fsf@nosuchdomain.example.com>
<uauppe$3k5gt$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="913a52d54f1fb8cef77698b79d9b2607";
logging-data="3933056"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NN1UbszK43KQLF/NNkOXT"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:ZdizWxohVnCFXZAOz4DrbbIC+p0=
sha1:pyvljUc7bPBVWsFGO9oYzow7vIo=
 by: Keith Thompson - Wed, 9 Aug 2023 02:01 UTC

Bart <bc@freeuk.com> writes:
[...]
> But I also don't believe these are the sources code to the basic gcc
> compiler, unless the basic compiler is 500MB.

gcc officially stands for "GNU Compiler Collection". (It was originally
"GNU C Compiler", but it was changed when support for other languages
was added.)

It includes compilers for a number of languages, including C, C++, Ada,
Fortran, Objective-C, Go, and Modula-2.

Since you've downloaded the sources, the libffi directory may or may not
be of some interest to you (see libffi/README.md).

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: you think rust may *DE*throne c?

<87zg31ezu5.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36505&group=comp.lang.c#36505

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: you think rust may *DE*throne c?
Date: Wed, 09 Aug 2023 03:04:02 +0100
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <87zg31ezu5.fsf@bsb.me.uk>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me> <uatr2m$3fla4$1@dont-email.me>
<909acf23-ef0e-44c7-9ebf-89846e50e871n@googlegroups.com>
<p_uAM.489417$mPI2.398490@fx15.iad>
<e5d7b49e-3472-4b70-8c52-d21243725d15n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="8fcde280a269416e5c30c74acd76122c";
logging-data="3939599"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Cifi5WLQ+EutkU1R39tyuKpt5Zq/CP7c="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:SfmqcyG1ZfFw0UDqeE277JIHH+M=
sha1:+6O/6dwuHZlpow64Adi2eo3I7xU=
X-BSB-Auth: 1.939fcf1827822bcc08d9.20230809030402BST.87zg31ezu5.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 9 Aug 2023 02:04 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

> On Tuesday, 8 August 2023 at 18:32:21 UTC+1, Scott Lurndal wrote:
>>
>> 1) Using a make variable in the rule for '.c' -> '.o' and setting the
>> variable to the name of the compiler:
>>
>> CC=bcc
>> ...
>> %.o: %.c
>> @$(QUIET) || echo " COMPILE $<"
>> $(HUSHCOMPILE)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
>>
> Exactly,
> Bart is right.

You are deliberately ignoring the context. Bart wants gcc prog.c to
write to prog, but in the computer world I inhabit, you do that with
make prog. No makefile needed. No mess. This is annoying to Bart
because he hates make almost as much as he hates C, so he adds another
twist -- what about all the compilers I have installed? Well, on my
system (hardly a special one) the answer for make-haters is, say,

CC=tcc make prog

Now you can put CC=tcc into a one-line makefile or say "export CC=tcc"
if you plan to do a lot of tcc builds but I expect even that will result
in a lot of fainting and clutching at pearls with the horrid complexity
of it all.

--
Ben.

Re: you think rust may *DE*throne c?

<c31f4356-99bd-45d9-a7e2-751a595fe852n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36508&group=comp.lang.c#36508

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:490c:b0:76c:cf92:a1a5 with SMTP id ed12-20020a05620a490c00b0076ccf92a1a5mr21300qkb.6.1691549066263;
Tue, 08 Aug 2023 19:44:26 -0700 (PDT)
X-Received: by 2002:a9d:7402:0:b0:6ba:8e4a:8e62 with SMTP id
n2-20020a9d7402000000b006ba8e4a8e62mr371119otk.7.1691549066120; Tue, 08 Aug
2023 19:44:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 8 Aug 2023 19:44:25 -0700 (PDT)
In-Reply-To: <87zg31ezu5.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:e56b:26d4:2c8f:8f29;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:e56b:26d4:2c8f:8f29
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me> <uatr2m$3fla4$1@dont-email.me>
<909acf23-ef0e-44c7-9ebf-89846e50e871n@googlegroups.com> <p_uAM.489417$mPI2.398490@fx15.iad>
<e5d7b49e-3472-4b70-8c52-d21243725d15n@googlegroups.com> <87zg31ezu5.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c31f4356-99bd-45d9-a7e2-751a595fe852n@googlegroups.com>
Subject: Re: you think rust may *DE*throne c?
From: malcolm.arthur.mclean@gmail.com (Malcolm McLean)
Injection-Date: Wed, 09 Aug 2023 02:44:26 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 39
 by: Malcolm McLean - Wed, 9 Aug 2023 02:44 UTC

On Wednesday, 9 August 2023 at 03:04:19 UTC+1, Ben Bacarisse wrote:
> Malcolm McLean <malcolm.ar...@gmail.com> writes:
> > On Tuesday, 8 August 2023 at 18:32:21 UTC+1, Scott Lurndal wrote:
> >>
> >> 1) Using a make variable in the rule for '.c' -> '.o' and setting the
> >> variable to the name of the compiler:
> >>
> >> CC=bcc
> >> ...
> >> %.o: %.c
> >> @$(QUIET) || echo " COMPILE $<"
> >> $(HUSHCOMPILE)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
> >>
> > Exactly,
> > Bart is right.
>
> You are deliberately ignoring the context. Bart wants gcc prog.c to
> write to prog, but in the computer world I inhabit, you do that with
> make prog. No makefile needed. No mess.
>
I never knew that. On my Apple it works.
The advantage of a.out as the executable name is that 99% of your builds
as a developer are test builds. It it's called "a.out" it's less likely to be
accidentally used as a finished program.
>
> This is annoying to Bart
> because he hates make almost as much as he hates C, so he adds another
> twist -- what about all the compilers I have installed? Well, on my
> system (hardly a special one) the answer for make-haters is, say,
>
> CC=tcc make prog
>
> Now you can put CC=tcc into a one-line makefile or say "export CC=tcc"
> if you plan to do a lot of tcc builds but I expect even that will result
> in a lot of fainting and clutching at pearls with the horrid complexity
> of it all.
>
The problem with make is not that it lacks functionality. It's that when
a makefile falls over it's too hard to fix.

Re: you think rust may outthrone c?

<169226c1-5531-4ea1-856b-f46ad0aeaf43n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36509&group=comp.lang.c#36509

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:4720:b0:767:fe53:3691 with SMTP id bs32-20020a05620a472000b00767fe533691mr104719qkb.3.1691551411767;
Tue, 08 Aug 2023 20:23:31 -0700 (PDT)
X-Received: by 2002:a05:6808:2209:b0:3a7:541c:8073 with SMTP id
bd9-20020a056808220900b003a7541c8073mr900284oib.2.1691551411450; Tue, 08 Aug
2023 20:23:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 8 Aug 2023 20:23:31 -0700 (PDT)
In-Reply-To: <uaufeh$3iq7v$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:e56b:26d4:2c8f:8f29;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:e56b:26d4:2c8f:8f29
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uab5ja$3mc91$1@dont-email.me> <uabeq1$3nigh$1@dont-email.me>
<uabobj$3oias$1@dont-email.me> <d124c512-5586-444e-9252-72e601502eaen@googlegroups.com>
<uaddgc$1lf7$1@dont-email.me> <d7fcd0d6-c5a5-4229-87d5-98f3129c9572n@googlegroups.com>
<87wmydv39y.fsf@bsb.me.uk> <c707dddd-c94e-47bf-9ae6-a8537d245ac1n@googlegroups.com>
<uaeivj$9urb$1@dont-email.me> <27a833dc-67b7-4195-a3f5-8d8c60ad3d2fn@googlegroups.com>
<uafsqe$mtv7$1@dont-email.me> <X=vUTZgAAVQwBn6et@bongo-ra.co>
<uaj4gk$1alq7$1@dont-email.me> <cbe7d004-e90b-41d7-9a34-c711ef9c3949n@googlegroups.com>
<uaj7iv$1b5h7$1@dont-email.me> <2caab55a-f70e-457f-a4d2-ee912c27b681n@googlegroups.com>
<ualceb$1nnq7$1@dont-email.me> <1aceef78-a719-424e-9234-63bc7531105cn@googlegroups.com>
<uatmcb$3eti9$1@dont-email.me> <a33ce226-3826-4b0c-97fc-585105018304n@googlegroups.com>
<uatrg9$3fncp$1@dont-email.me> <2eb60e6c-5f68-40fb-afef-c41ca8bb3683n@googlegroups.com>
<uaufeh$3iq7v$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <169226c1-5531-4ea1-856b-f46ad0aeaf43n@googlegroups.com>
Subject: Re: you think rust may outthrone c?
From: malcolm.arthur.mclean@gmail.com (Malcolm McLean)
Injection-Date: Wed, 09 Aug 2023 03:23:31 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 8325
 by: Malcolm McLean - Wed, 9 Aug 2023 03:23 UTC

On Tuesday, 8 August 2023 at 23:26:47 UTC+1, David Brown wrote:
> On 08/08/2023 19:04, Malcolm McLean wrote:
> > On Tuesday, 8 August 2023 at 17:46:15 UTC+1, David Brown wrote:
> >> On 08/08/2023 18:04, Malcolm McLean wrote:
> >>> On Tuesday, 8 August 2023 at 16:18:49 UTC+1, David Brown wrote:
> >>>> On 05/08/2023 14:08, Malcolm McLean wrote:
> >>>>
> >>>>> This is the problem of course. The Baby X API expects data in a certain format.
> >>>>> So all the API functions which operate on images take a 32 bit RGBA buffer
> >>>>> as an "unsigned char *", and the dimensions as two ints. But another API might
> >>>>> use an opaque "IMAGE" structure. Or another system might have 16 bit r5g5b5a1
> >>>>> images.
> >>>>
> >>>> It would make a lot of sense to have a program that took data in common
> >>>> standardised uncompressed forms (like .wav, .bmp) and generated data in
> >>>> whatever format suits Baby X.
> >>>>
> >>> "Data" means, "that which is given". People programming applications are given
> >>> resources in many formats. They might steal a PNG from the web, get a JPEG
> >>> commissioned from a paid artist, knock up their own SVG.
> >>> Now of course it's possible to convert all these into a common format like PNG
> >>> which is powerful enough to hold all thse formats without loss. But you've lost
> >>> the link with the original data. So when the artist comes back with a second
> >>> version of the JPEG, you've got to run ImageMagick again. And I don't have
> >>> ImageMagick installed on the Mac I'm writing this on (there's a program called
> >>> sips which does similar things).
> >>> A resouce pipeline with lots of stages, each one requiring a separate third party
> >>> program, is quite fragile. It works for as long as your Linux machine is all set up
> >>> with the dependencies, which will be the case for the duration of the project.
> >>> But if you archive it, and dust it off years later, will things still be intact? And
> >>> will you know which are the intermediate files, and which are the original data?
> >> It looks like there is someone else in this group who could benefit from
> >> understanding "make" and/or other build tools. And if you can't use a
> >> Mac for development, scrap the expensive toy and install a usable
> >> system. (Of course, you /can/ use a Mac for development - you just need
> >> to know how to use your tools.)
> >>
> > Bart's right about make. If it actually worked properly we wouldn't need CMake.
> "make" works perfectly well for its purpose. CMake is a different tool,
> doing a different job. In fact, CMake generates makefiles for use by
> "make" (as well as project files for MSVC, and other types of build
> system). CMake is a higher level tool. ("make" can, in combination
> with compilers like gcc, do a fair amount of higher level work as well,
> such as tracking dependencies and files automatically.)
>
CMake is an alternative to make. It can generate make files, in fact that's the
default. Which means that if you ship a project with a CMake script, you
wouldn't normally provide a make file. CMake found a niche largely because
make files are too difficult to use. The other reason is that the big IDEs
rejected makefiles as their format for describing how to build projects.
>
> One thing that "make" is particularly good at is chains of processes.
> It is straightforward to say that "picture.o" is compiled from
> "picture.c" which is resource-compiled from "picture.bmp" which is
> converted from "picture.jpg". I sometimes have that kind of thing in
> makefiles for building documentation, where the graphics files I want to
> add to my LaTeX documents might need conversions or manipulations from
> the originals.
>
> > But it's unmaintainable.
>
> Not for people who are familiar with it.
>
Many programmers might start a new project only once every two years. And
it might not be their job to write the makefile. So they are not going to be very
familiar with make. Maintainable software needs to be maintainable by people
who don't have a deep familarity with it. I can debug Cmake scripts despite
not really knowing the CMake language, because it's close enough to a normal
procedural programming language for someone who can program but doesn't
know CMake specifically to follow along.
>
> Certainly complicated makefiles are harder to deal with than simple
> ones. It's a powerful tool with many features, and takes time and
> effort to learn. But complicated ones can reduce maintenance - my
> makefiles do not need modification as files are added or removed from a
> project, or dependencies on headers change - it is all handled
> automatically.
>
> > Baby X is mainly for small hobby type programs. It's easier to use than
> > the raw X11 interface, and it's far lighter weight than Qt or GTK. It also
> > ports to Windows. So most of the users will be bedroom programmers
> > who will set up the internationalisation strings themselves, rather than
> > employing professional translators.
> That is a hopeless attitude to take. You are simply guaranteeing that
> people will not use it for internationalisation - or that they will hate
> the tool when they try to use it. Targeting hobby users is not an
> excuse for bad design. I would suggest you remove all traces of
> internationalisation until you have found a way to make it work. (And
> drop the XML format while you are at it - a simple one line, one command
> text format would be vastly easier for everyone.)
>
It works. The question is whether it's a good approach to the problem.
As I said, the user of Baby X will be mostly hobby programmers. So the
emphasis is on making things easy to use. Adding alternative translations
under an <international> tag is easy to do.

However I fully accept that there might be a far better approach. Keith
Thompson has made some constructive suggestions.

XML has some advantages over an ad-hoc line-based format. The parser needs
work as it's currently too basic. But XML should be familiar to most programmers.

Re: you think rust may outthrone c?

<uavjga$3s9cs$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36518&group=comp.lang.c#36518

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.87.79-160-51.customer.lyse.net!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 9 Aug 2023 10:41:45 +0200
Organization: A noiseless patient Spider
Message-ID: <uavjga$3s9cs$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaj4gk$1alq7$1@dont-email.me>
<cbe7d004-e90b-41d7-9a34-c711ef9c3949n@googlegroups.com>
<uaj7iv$1b5h7$1@dont-email.me>
<2caab55a-f70e-457f-a4d2-ee912c27b681n@googlegroups.com>
<ualceb$1nnq7$1@dont-email.me>
<1aceef78-a719-424e-9234-63bc7531105cn@googlegroups.com>
<uatmcb$3eti9$1@dont-email.me>
<a33ce226-3826-4b0c-97fc-585105018304n@googlegroups.com>
<uatrg9$3fncp$1@dont-email.me>
<2eb60e6c-5f68-40fb-afef-c41ca8bb3683n@googlegroups.com>
<fivAM.481172$SuUf.145293@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 9 Aug 2023 08:41:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="87.79-160-51.customer.lyse.net:79.160.51.87";
logging-data="4072860"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.6.1
In-Reply-To: <fivAM.481172$SuUf.145293@fx14.iad>
Content-Language: en-GB
 by: David Brown - Wed, 9 Aug 2023 08:41 UTC

On 08/08/2023 19:53, Scott Lurndal wrote:
> Properly designed makefiles are a joy
> to work with.
>

They are a joy to work with, yes. But they can be less joyful to write
sometimes, and debugging is rarely easy. However, you rarely have to
write them in practice - usually for a new project, I take an existing
makefile (or set of makefiles) and change details such as project name,
compiler, flags, etc., and we are off. I am not sure if I have started
a new makefile from scratch since my first one many decades ago!

Re: you think rust may outthrone c?

<uavods$3t1r3$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36519&group=comp.lang.c#36519

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.cpc109573-know16-2-0-cust636.17-2.cable.virginm.net!not-for-mail
From: bc@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 9 Aug 2023 11:05:48 +0100
Organization: A noiseless patient Spider
Message-ID: <uavods$3t1r3$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<87r0okvrht.fsf@bsb.me.uk> <uag05n$nmu5$1@dont-email.me>
<uagcgc$ppbn$1@dont-email.me> <87fs50ulog.fsf@bsb.me.uk>
<uagpni$rt71$1@dont-email.me> <87r0ohrvg0.fsf@bsb.me.uk>
<uamlh1$1tr9i$1@dont-email.me> <875y5tkptn.fsf@bsb.me.uk>
<uans1e$26toe$1@dont-email.me> <87cyzzkfxh.fsf@nosuchdomain.example.com>
<uap5e6$2gd8e$1@dont-email.me> <87350vke4n.fsf@nosuchdomain.example.com>
<uap73l$2gktp$1@dont-email.me> <87y1initxx.fsf@nosuchdomain.example.com>
<uapf90$2ht0t$1@dont-email.me> <87leenirja.fsf@nosuchdomain.example.com>
<uaqdst$2q82c$1@dont-email.me> <8M4AM.510037$TPw2.337804@fx17.iad>
<uaqqou$2sa5t$1@dont-email.me> <87wmy6j37n.fsf@bsb.me.uk>
<uara1m$2uq73$1@dont-email.me> <20230807125815.939@kylheku.com>
<uas273$32k64$1@dont-email.me> <2FhAM.351580$xMqa.250758@fx12.iad>
<uat7ht$3camf$1@dont-email.me> <qsqAM.133251$f7Ub.122358@fx47.iad>
<uatimv$3e73n$1@dont-email.me> <rpCAM.87315$ftCb.76427@fx34.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 9 Aug 2023 10:05:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cpc109573-know16-2-0-cust636.17-2.cable.virginm.net:94.175.38.125";
logging-data="4097891"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
In-Reply-To: <rpCAM.87315$ftCb.76427@fx34.iad>
 by: Bart - Wed, 9 Aug 2023 10:05 UTC

On 09/08/2023 02:58, Richard Damon wrote:
> On 8/8/23 10:16 AM, Bart wrote:
>> > Then they are using the wrong tool.
>>
>> What tool did you have in mind? Do you mean that an IDE will tell you
>> the types of the expressions, or write the format codes for you?
>
> IF you actually want to output expressions that you don't know the type,
> you need something that supports that. Maybe C++, maybe Python, maybe
> something else like that.
>
> It seems you have one tool in your box, so everything is a nail.

So, by 'tool' you mean a different language?

>> I do. It's lovely. The question is, why are a million users of C
>> denied that?

> Because that isn't C. If you want basic, you know where to find it.

So, the answer isn't a different language? I'm confused!

What tool did you have in mind if I wanted to print stuff easily in C?

>
> Note, "println" like that can't do a lot of things that printf can do
> when properly used, so it becomes the problem of just using the right
tool.

99% of the print statements I write (not 99% of the ones that are
permanent parts of source code) are temporary debug statements. Their
formatting needs are minimal.

In my syntax, I would most commonly write 'println =a,=b' where the '='
adds a label to the output, which might look like:

A=100 B=100

>> Sorry, but that is rubbish. My 'M' language is also low level, but
>> somehow manages to have a proper print. And it's not dead slow either:
>
> And I bet it only runs on x86 processors?

The very first version ran on Z80 8-bit processors. The current one
generates native code for x64 for Windows.

I can run my programs also on ARM devices and/or on Linux but it needs
to use intermediate C code (which is where all the problems of C come
into play).

My first compiler though was for a language that wasn't mine; it
generated native code for the 36-bit PDP10 processor. I can't remember
the Print facilities of that language, except that it wouldn't have used
format codes!

>>
>> A loop which prints the numbers up to 10 million (redirected to a file
>> to remove display overheads), takes 1.8 seconds in my language, and
>> 3.2 seconds using gcc 13.2 -O3. bcc/tcc take 2.4 seconds.
>>
>> (My library is faster, despite the int->text code being unoptimised,
>> because of buffering. But then maybe gcc's printf is also buffered
>> internally. Which one is cheating more? I know mine won in this case!)
>
> Maybe you used the wrong C library to do that.

So tell me how to get gcc 10.3 /or/ gcc 13.2 faster, as I don't know
how. I mean, that is not my problem.

> Also, since you have shown that you format routines don't meet the full
> functionality of C's, that will give it an advantage.

What functionality are you thinking of? I can do nearly everything that
printf can, and when it can't, I can just call printf.

>> There is no tool, and no feature in my language (other than turning it
>> into C), that will fix the problem that C's 'char*' is so unique.
>
> Why is C's char* being unique a problem?

Because in language X, strings and string literals are sequences of
unsigned bytes. If transpiling to C, how do you represent string
literals of X for example?

Writing "ABC" will create a term that in C has type char*, not unsigned
char*, which can cause problems used with string objects that are
declared as unsigned char*.

If you cast every string literal as (unsigned char*)"ABC", then it will
cause problems in calling C functions like puts(), which take a char*
parameter.

If you declare, in the generated C, your own version of puts that takes
unsigned char*, then a compiler like gcc will complain that it is an
incorrect prototype for a standard function.

This is about where I'm at. But further, there will be innumerable other
functions in myriad libraries that take char* arguments.

> It still sounds like the problem is you don't understand what C is
> doing, so you are misusing it.

The problem is C's bizarre plain 'char' type, which like some quantum
particle, although it necessarily has to be signed or unsigned, you're
not allowed to assume either one or the other in any program. So there
are three classes of char types.

> Your thinking about the wrong machine. Remember, in C, the machine you
> need to be thinking about is the "abstract machine" defined by the
> standard.

I have my own model in mind of the machine I want to write for. It more
or less identical to the actual physical machines most of us use.

But C doesn't allow that because /its/ model has to be a single one that
has to work on every conceivable architecture past, present and future,
including the DeathStation 9000.

Which is not that practical of course that's why there is so much UB and
so much that is vaguely defined. (stdint.h is a bolted-on concession,
but that works poorly.)

That is of no interest to those of us with language X which we want to
run on machine Y, but do not support direcly so need to go through C.

> One big aspect of printf, is you need to know the "type" of each
> arguement you give it. If you do, it works well, if you don't you just
> can't use it.
>
> You seem to think this is a bug instead of its design decision.

It's designed that way so it's not a bug, but it's just poor:

int i=1234;

printf("i = %s", i);

Or even printf("%s").

Crash.

Sure, a few decades on, /some/ compilers will detect that mismatch (even
though they're not supposed to know the workings of library routines),
but that's just a poor sticking plaster fix.

My simple C compiler can't detect it. (It does have the %? format which
adapts to the actual type used in the argument, but that won't work
anywhere else.)

> Try to explain how you would change C so that printf could be more
> forgiving on the type given to it without totally changing how the
> language works.

As I said, I played with "%?" format (and also "%=?") so that you can write:

void* a=&a;
double b=34.5;
char* c="Bart";
uint64_t d=-1;

printf("%=? %=? %=? %=?\n", a, b, c, d);

Output is:

A=000000000080FF18 B=34.500000 C=Bart D=18446744073709551615

It doesn't solve all the problems in all cases, and sometimes you need
to use a proper format (eg, you might want hex output for 'd'), but it
covers most of my casual uses of printf.

At least it's something; what have /you/ done alone those lines?

And you can do this:

printf("%=? %=? %=? %=?\n", d, b, c, a);

Reverse the item order, but you don't need to edit the format string.
Output now is:

D=18446744073709551615 B=34.500000 C=Bart A=000000000080FF18

That is amazing, I can do what most languages from the 1970s were
capable of!

Re: you think rust may *DE*throne c?

<uavpcf$3t64r$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36520&group=comp.lang.c#36520

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.cpc109573-know16-2-0-cust636.17-2.cable.virginm.net!not-for-mail
From: bc@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may *DE*throne c?
Date: Wed, 9 Aug 2023 11:22:07 +0100
Organization: A noiseless patient Spider
Message-ID: <uavpcf$3t64r$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me> <uatr2m$3fla4$1@dont-email.me>
<909acf23-ef0e-44c7-9ebf-89846e50e871n@googlegroups.com>
<p_uAM.489417$mPI2.398490@fx15.iad>
<e5d7b49e-3472-4b70-8c52-d21243725d15n@googlegroups.com>
<87zg31ezu5.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 9 Aug 2023 10:22:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cpc109573-know16-2-0-cust636.17-2.cable.virginm.net:94.175.38.125";
logging-data="4102299"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
In-Reply-To: <87zg31ezu5.fsf@bsb.me.uk>
 by: Bart - Wed, 9 Aug 2023 10:22 UTC

On 09/08/2023 03:04, Ben Bacarisse wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>
>> On Tuesday, 8 August 2023 at 18:32:21 UTC+1, Scott Lurndal wrote:
>>>
>>> 1) Using a make variable in the rule for '.c' -> '.o' and setting the
>>> variable to the name of the compiler:
>>>
>>> CC=bcc
>>> ...
>>> %.o: %.c
>>> @$(QUIET) || echo " COMPILE $<"
>>> $(HUSHCOMPILE)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
>>>
>> Exactly,
>> Bart is right.
>
> You are deliberately ignoring the context. Bart wants gcc prog.c to
> write to prog, but in the computer world I inhabit, you do that with
> make prog.

This is a good example of double standards.

I've complained in the past about having to supply the .c extension to a
/C/ compiler.

Now here make does not need an extension. And make presumably can build
any source code of any language?

How does it know then to deal with prog.c and not prog.cpp or prog.ftn?

How does it know that it has to produce (on Windows) prog.exe?

Wasn't there a huge subthread about people not wanting gcc to
double-guess the name of the executable, even for a single module, so
that a.out or a.exe would be the most acceptable result?

And yet, that is considered common-sense with 'make'? Hmmm....

Besides, there are issues here; make will not supply the -lm flag when
it is needed for example.

And if you do 'make prog' a second time, it will not run the compiler
again. (Sometimes, you are timing how long the compilation takes! Or
maybe there's a time-stamp inside the program.)

Or you need to compile first with -O0 and then when -O3.

> because he hates make almost as much as he hates C, so he adds another
> twist -- what about all the compilers I have installed? Well, on my
> system (hardly a special one) the answer for make-haters is, say,
>
> CC=tcc make prog
>
> Now you can put CC=tcc into a one-line makefile or say "export CC=tcc"
> if you plan to do a lot of tcc builds but I expect even that will result
> in a lot of fainting and clutching at pearls with the horrid complexity
> of it all.

When comparing different compilers I might do:

bcc prog
tcc prog.c
gcc prog.c
gcc prog.c -O3

dmc prog.c in the past
lcc prog.c
cl prog.c

(All of these produce prog.exe - except gcc which produces a.exe,
obviously, because that's the most useful choice, right?!)

So how does make help here?

Re: you think rust may *DE*throne c?

<uavq70$3t9gl$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36522&group=comp.lang.c#36522

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.90.216.134.213!not-for-mail
From: richard.nospam@gmail.com (Richard Harnden)
Newsgroups: comp.lang.c
Subject: Re: you think rust may *DE*throne c?
Date: Wed, 9 Aug 2023 11:36:13 +0100
Organization: A noiseless patient Spider
Message-ID: <uavq70$3t9gl$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me> <uatr2m$3fla4$1@dont-email.me>
<909acf23-ef0e-44c7-9ebf-89846e50e871n@googlegroups.com>
<p_uAM.489417$mPI2.398490@fx15.iad>
<e5d7b49e-3472-4b70-8c52-d21243725d15n@googlegroups.com>
<87zg31ezu5.fsf@bsb.me.uk> <uavpcf$3t64r$1@dont-email.me>
Reply-To: nospam.harnden@gmail.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 9 Aug 2023 10:36:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="90.216.134.213";
logging-data="4105749"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
In-Reply-To: <uavpcf$3t64r$1@dont-email.me>
 by: Richard Harnden - Wed, 9 Aug 2023 10:36 UTC

On 09/08/2023 11:22, Bart wrote:
> On 09/08/2023 03:04, Ben Bacarisse wrote:
> > Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> >
> >> On Tuesday, 8 August 2023 at 18:32:21 UTC+1, Scott Lurndal wrote:
> >>>
> >>> 1) Using a make variable in the rule for '.c' -> '.o' and setting the
> >>> variable to the name of the compiler:
> >>>
> >>> CC=bcc
> >>> ...
> >>> %.o: %.c
> >>> @$(QUIET) || echo " COMPILE $<"
> >>> $(HUSHCOMPILE)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
> >>>
> >> Exactly,
> >> Bart is right.
> >
> > You are deliberately ignoring the context.  Bart wants gcc prog.c to
> > write to prog, but in the computer world I inhabit, you do that with
> > make prog.
>
> This is a good example of double standards.
>
> I've complained in the past about having to supply the .c extension to a
> /C/ compiler.
>
> Now here make does not need an extension. And make presumably can build
> any source code of any language?
>
> How does it know then to deal with prog.c and not prog.cpp or prog.ftn?
>
> How does it know that it has to produce (on Windows) prog.exe?
>
> Wasn't there a huge subthread about people not wanting gcc to
> double-guess the name of the executable, even for a single module, so
> that a.out or a.exe would be the most acceptable result?
>
> And yet, that is considered common-sense with 'make'? Hmmm....
>
> Besides, there are issues here; make will not supply the -lm flag when
> it is needed for example.
>
> And if you do 'make prog' a second time, it will not run the compiler
> again. (Sometimes, you are timing how long the compilation takes! Or
> maybe there's a time-stamp inside the program.)
>
> Or you need to compile first with -O0 and then when -O3.
>
> > because he hates make almost as much as he hates C, so he adds another
> > twist -- what about all the compilers I have installed?  Well, on my
> > system (hardly a special one) the answer for make-haters is, say,
> >
> >    CC=tcc make prog
> >
> > Now you can put CC=tcc into a one-line makefile or say "export CC=tcc"
> > if you plan to do a lot of tcc builds but I expect even that will result
> > in a lot of fainting and clutching at pearls with the horrid complexity
> > of it all.
>
> When comparing different compilers I might do:
>
>    bcc prog
>    tcc prog.c
>    gcc prog.c
>    gcc prog.c -O3
>
>    dmc prog.c           in the past
>    lcc prog.c
>    cl prog.c
>
> (All of these produce prog.exe - except gcc which produces a.exe,
> obviously, because that's the most useful choice, right?!)
>
> So how does make help here?
>
>

It just does it ...

$ >test_c++.cpp
$ make test_c++
g++ test_c++.cpp -o test_c++

$ >test_c.c
$ make test_c
cc test_c.c -o test_c

Re: you think rust may outthrone c?

<uavr6v$3tbeo$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36523&group=comp.lang.c#36523

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.cpc109573-know16-2-0-cust636.17-2.cable.virginm.net!not-for-mail
From: bc@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 9 Aug 2023 11:53:19 +0100
Organization: A noiseless patient Spider
Message-ID: <uavr6v$3tbeo$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uag05n$nmu5$1@dont-email.me> <uagcgc$ppbn$1@dont-email.me>
<87fs50ulog.fsf@bsb.me.uk> <uagpni$rt71$1@dont-email.me>
<87r0ohrvg0.fsf@bsb.me.uk> <uamlh1$1tr9i$1@dont-email.me>
<875y5tkptn.fsf@bsb.me.uk> <uans1e$26toe$1@dont-email.me>
<87cyzzkfxh.fsf@nosuchdomain.example.com> <uap5e6$2gd8e$1@dont-email.me>
<87350vke4n.fsf@nosuchdomain.example.com> <uap73l$2gktp$1@dont-email.me>
<87y1initxx.fsf@nosuchdomain.example.com> <uapf90$2ht0t$1@dont-email.me>
<87leenirja.fsf@nosuchdomain.example.com> <uaqdst$2q82c$1@dont-email.me>
<8M4AM.510037$TPw2.337804@fx17.iad> <uaqqou$2sa5t$1@dont-email.me>
<87wmy6j37n.fsf@bsb.me.uk> <uara1m$2uq73$1@dont-email.me>
<20230807125815.939@kylheku.com> <uas273$32k64$1@dont-email.me>
<2FhAM.351580$xMqa.250758@fx12.iad> <uat7ht$3camf$1@dont-email.me>
<qsqAM.133251$f7Ub.122358@fx47.iad> <uatimv$3e73n$1@dont-email.me>
<rpCAM.87315$ftCb.76427@fx34.iad> <uavods$3t1r3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 9 Aug 2023 10:53:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cpc109573-know16-2-0-cust636.17-2.cable.virginm.net:94.175.38.125";
logging-data="4107736"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
In-Reply-To: <uavods$3t1r3$1@dont-email.me>
 by: Bart - Wed, 9 Aug 2023 10:53 UTC

On 09/08/2023 11:05, Bart wrote:

> And you can do this:
>
> printf("%=? %=? %=? %=?\n", d, b, c, a);
>
> Reverse the item order, but you don't need to edit the format string.
> Output now is:
>
> D=18446744073709551615 B=34.500000 C=Bart A=000000000080FF18

Oops, I forgot to reverse b and c. But it still applies the correct
formats and labels. Make that mistake with normal printf and ... boom!

Actually I can try it, using this line with b and c in the wrong order:

printf("D=%llu C=%s B=%f A=%p\n", d, b, c, a);

With bcc, tcc and gcc, it compiles OK, but crashes.

Isn't gcc supposed to warn about this? Maybe there's some option to do
it, but I don't know what it is. Lot's of people will not know.

The weird thing is that with online gcc/Clang, it compiles and runs and
produces:

D=18446744073709551615 C=Bart B=34.500000 A=0x7ffd33e16bf0

C and B are shown correctly, even though they're in the wrong order! How
is that possible? Switching them has no effect.

It seems to rearrange the inner arguments to match the format codes.

(I think I know what's going on: the online compilers run on Linux,
presumably on x64, with a different ABI.

When it looks for the arg matching "%s", it's picking up the value of c,
the next argument from a GP register, since b is in a floating point
register, and vice versa.

That doesn't happen on Win64 ABI as register assignments are different.)

Here is the full program:

#include <stdio.h>
#include <stdint.h>

int main(void) {
void* a=&a;
double b=34.5;
char* c="Bart";
uint64_t d=-1;

printf("D=%llu C=%s B=%f A=%p\n", d, b, c, a);
}

Re: you think rust may *DE*throne c?

<uavrg0$3tbeo$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36524&group=comp.lang.c#36524

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.cpc109573-know16-2-0-cust636.17-2.cable.virginm.net!not-for-mail
From: bc@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: you think rust may *DE*throne c?
Date: Wed, 9 Aug 2023 11:58:08 +0100
Organization: A noiseless patient Spider
Message-ID: <uavrg0$3tbeo$2@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me> <uatr2m$3fla4$1@dont-email.me>
<909acf23-ef0e-44c7-9ebf-89846e50e871n@googlegroups.com>
<p_uAM.489417$mPI2.398490@fx15.iad>
<e5d7b49e-3472-4b70-8c52-d21243725d15n@googlegroups.com>
<87zg31ezu5.fsf@bsb.me.uk> <uavpcf$3t64r$1@dont-email.me>
<uavq70$3t9gl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 9 Aug 2023 10:58:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cpc109573-know16-2-0-cust636.17-2.cable.virginm.net:94.175.38.125";
logging-data="4107736"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
In-Reply-To: <uavq70$3t9gl$1@dont-email.me>
 by: Bart - Wed, 9 Aug 2023 10:58 UTC

On 09/08/2023 11:36, Richard Harnden wrote:
> On 09/08/2023 11:22, Bart wrote:
>> On 09/08/2023 03:04, Ben Bacarisse wrote:
>>  > Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>  >
>>  >> On Tuesday, 8 August 2023 at 18:32:21 UTC+1, Scott Lurndal wrote:
>>  >>>
>>  >>> 1) Using a make variable in the rule for '.c' -> '.o' and setting
>> the
>>  >>> variable to the name of the compiler:
>>  >>>
>>  >>> CC=bcc
>>  >>> ...
>>  >>> %.o: %.c
>>  >>> @$(QUIET) || echo " COMPILE $<"
>>  >>> $(HUSHCOMPILE)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
>>  >>>
>>  >> Exactly,
>>  >> Bart is right.
>>  >
>>  > You are deliberately ignoring the context.  Bart wants gcc prog.c to
>>  > write to prog, but in the computer world I inhabit, you do that with
>>  > make prog.
>>
>> This is a good example of double standards.
>>
>> I've complained in the past about having to supply the .c extension to
>> a /C/ compiler.
>>
>> Now here make does not need an extension. And make presumably can
>> build any source code of any language?
>>
>> How does it know then to deal with prog.c and not prog.cpp or prog.ftn?
>>
>> How does it know that it has to produce (on Windows) prog.exe?
>>
>> Wasn't there a huge subthread about people not wanting gcc to
>> double-guess the name of the executable, even for a single module, so
>> that a.out or a.exe would be the most acceptable result?
>>
>> And yet, that is considered common-sense with 'make'? Hmmm....
>>
>> Besides, there are issues here; make will not supply the -lm flag when
>> it is needed for example.
>>
>> And if you do 'make prog' a second time, it will not run the compiler
>> again. (Sometimes, you are timing how long the compilation takes! Or
>> maybe there's a time-stamp inside the program.)
>>
>> Or you need to compile first with -O0 and then when -O3.
>>
>>  > because he hates make almost as much as he hates C, so he adds another
>>  > twist -- what about all the compilers I have installed?  Well, on my
>>  > system (hardly a special one) the answer for make-haters is, say,
>>  >
>>  >    CC=tcc make prog
>>  >
>>  > Now you can put CC=tcc into a one-line makefile or say "export CC=tcc"
>>  > if you plan to do a lot of tcc builds but I expect even that will
>> result
>>  > in a lot of fainting and clutching at pearls with the horrid
>> complexity
>>  > of it all.
>>
>> When comparing different compilers I might do:
>>
>>     bcc prog
>>     tcc prog.c
>>     gcc prog.c
>>     gcc prog.c -O3
>>
>>     dmc prog.c           in the past
>>     lcc prog.c
>>     cl prog.c
>>
>> (All of these produce prog.exe - except gcc which produces a.exe,
>> obviously, because that's the most useful choice, right?!)
>>
>> So how does make help here?
>>
>>
>
> It just does it ...
>
> $ >test_c++.cpp
> $ make test_c++
> g++     test_c++.cpp   -o test_c++
>
> $ >test_c.c
> $ make test_c
> cc     test_c.c   -o test_c

That doesn't address my points.

Here file name are different. So:

* What happens if there is both test.c and test.cpp?

* What happens if first you want compiler X for test.c and then you want
compiler Y for test.c?

Re: you think rust may *DE*throne c?

<slrnud6spf.f45.dan@djph.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36525&group=comp.lang.c#36525

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.2603-6010-dc01-2602-123d-1cff-feaf-14b4.res6.spectrum.com!not-for-mail
From: dan@djph.net (Dan Purgert)
Newsgroups: comp.lang.c
Subject: Re: you think rust may *DE*throne c?
Date: Wed, 9 Aug 2023 11:05:04 -0000 (UTC)
Organization: A noiseless patient Spider
Message-ID: <slrnud6spf.f45.dan@djph.net>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaavm0$3ln4f$1@dont-email.me> <uab5ja$3mc91$1@dont-email.me>
<uabeq1$3nigh$1@dont-email.me> <uabobj$3oias$1@dont-email.me>
<uaduf0$54pp$1@dont-email.me> <uajaqg$1bc41$4@dont-email.me>
<uajfq3$1cesi$1@dont-email.me> <uat7t4$3cco6$1@dont-email.me>
<uat9ca$3cjmt$1@dont-email.me> <uatjcp$3ec7b$1@dont-email.me>
<uatlrr$3epln$1@dont-email.me> <uatr2m$3fla4$1@dont-email.me>
<909acf23-ef0e-44c7-9ebf-89846e50e871n@googlegroups.com>
<p_uAM.489417$mPI2.398490@fx15.iad>
<e5d7b49e-3472-4b70-8c52-d21243725d15n@googlegroups.com>
<87zg31ezu5.fsf@bsb.me.uk> <uavpcf$3t64r$1@dont-email.me>
Injection-Date: Wed, 9 Aug 2023 11:05:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2603-6010-dc01-2602-123d-1cff-feaf-14b4.res6.spectrum.com:2603:6010:dc01:2602:123d:1cff:feaf:14b4";
logging-data="4113345"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: slrn/1.0.3 (Linux)
 by: Dan Purgert - Wed, 9 Aug 2023 11:05 UTC

On 2023-08-09, Bart wrote:
> On 09/08/2023 03:04, Ben Bacarisse wrote:
> > Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> >
> >> On Tuesday, 8 August 2023 at 18:32:21 UTC+1, Scott Lurndal wrote:
> >>>
> >>> 1) Using a make variable in the rule for '.c' -> '.o' and setting the
> >>> variable to the name of the compiler:
> >>>
> >>> CC=bcc
> >>> ...
> >>> %.o: %.c
> >>> @$(QUIET) || echo " COMPILE $<"
> >>> $(HUSHCOMPILE)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
> >>>
> >> Exactly,
> >> Bart is right.
> >
> > You are deliberately ignoring the context. Bart wants gcc prog.c to
> > write to prog, but in the computer world I inhabit, you do that with
> > make prog.
>
> This is a good example of double standards.
>
> I've complained in the past about having to supply the .c extension to a
> /C/ compiler.
>
> Now here make does not need an extension. And make presumably can build
> any source code of any language?

'make(1)' is a tool for automating builds. When you write a makefile,
you supply various targets, such as "clean" or "install", etc.

Your target then has the necessary (chain of) commands to complete the
build (or do another task -- such as deleting all the intermediate
object files with a "clean" target, or copying binaries to
/usr/local/bin for the "install" target).

>
> How does it know then to deal with prog.c and not prog.cpp or prog.ftn?

Because you wrote your makefile target such that it's dealing with
"prog.c" and not prog.cpp or prog.ftn. Make isn't intelligent in the
case of changing file extensions or similar. For example, renaming
"prog.c" to "prog.cpp" will result in 'file not found' errors when make
is trying to run the defined 'gcc prog.c -o prog' command.

>
> How does it know that it has to produce (on Windows) prog.exe?

It doesn't, unless you have a "_forWin" target that names the output
"prog.exe".

> [...]
> And if you do 'make prog' a second time, it will not run the compiler
> again. (Sometimes, you are timing how long the compilation takes! Or
> maybe there's a time-stamp inside the program.)

Make is written to save compile time. Why bother re-compiling half a
dozen supporting files when all I did was patch out a bug in 'main()'?

>
> Or you need to compile first with -O0 and then when -O3.

So run the two compilations as part of the same target (unless you mean
to say you want two different targets with two different sets of options
for some reason).

--
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860

Re: you think rust may outthrone c?

<3e411721-6448-475a-a834-116ff478aa29n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36526&group=comp.lang.c#36526

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:6413:b0:76d:fe8:1b03 with SMTP id pz19-20020a05620a641300b0076d0fe81b03mr44134qkn.15.1691579234128;
Wed, 09 Aug 2023 04:07:14 -0700 (PDT)
X-Received: by 2002:a63:3ec3:0:b0:564:aeb6:c36d with SMTP id
l186-20020a633ec3000000b00564aeb6c36dmr86004pga.1.1691579232900; Wed, 09 Aug
2023 04:07:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 9 Aug 2023 04:07:12 -0700 (PDT)
In-Reply-To: <20230808164841.541@kylheku.com>
Injection-Info: google-groups.googlegroups.com; posting-host=199.203.251.52; posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 199.203.251.52
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uag05n$nmu5$1@dont-email.me> <uagcgc$ppbn$1@dont-email.me>
<87fs50ulog.fsf@bsb.me.uk> <uagpni$rt71$1@dont-email.me> <87r0ohrvg0.fsf@bsb.me.uk>
<uamlh1$1tr9i$1@dont-email.me> <875y5tkptn.fsf@bsb.me.uk> <uans1e$26toe$1@dont-email.me>
<87cyzzkfxh.fsf@nosuchdomain.example.com> <uap5e6$2gd8e$1@dont-email.me>
<87350vke4n.fsf@nosuchdomain.example.com> <uap73l$2gktp$1@dont-email.me>
<87y1initxx.fsf@nosuchdomain.example.com> <uapf90$2ht0t$1@dont-email.me>
<87leenirja.fsf@nosuchdomain.example.com> <uaqdst$2q82c$1@dont-email.me>
<87leemseod.fsf@nosuchdomain.example.com> <uas0k1$32e8o$2@dont-email.me>
<877cq6s60y.fsf@nosuchdomain.example.com> <uat5n4$3c1rg$1@dont-email.me>
<87v8dpqk2x.fsf@nosuchdomain.example.com> <uauf1m$3iofh$2@dont-email.me>
<20230808155150.344@kylheku.com> <uaujc2$3jbrq$1@dont-email.me> <20230808164841.541@kylheku.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3e411721-6448-475a-a834-116ff478aa29n@googlegroups.com>
Subject: Re: you think rust may outthrone c?
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Wed, 09 Aug 2023 11:07:14 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Michael S - Wed, 9 Aug 2023 11:07 UTC

On Wednesday, August 9, 2023 at 2:50:32 AM UTC+3, Kaz Kylheku wrote:
> On 2023-08-08, Bart <b...@freeuk.com> wrote:
> > On 08/08/2023 23:58, Kaz Kylheku wrote:
> > > On 2023-08-08, Bart <b...@freeuk.com> wrote:
> > >> On 08/08/2023 22:51, Keith Thompson wrote:
> > >>> Bart <b...@freeuk.com> writes:
> > >>>> On 08/08/2023 01:59, Keith Thompson wrote:
> > >>> [...]
> > >>>>> bcc is your implementation, right?
> > >>>>
> > >>>> It's my compiler, but it uses msvcrt.dll to do the print. tcc uses the
> > >>>> same library with the same output. Both seem to use a default of 6
> > >>>> places after the ".", whether hex or decimal.
> > >>> [SNIP]
> > >>>
> > >>> To summarize, your implementation (bcc) uses msvcrt.dll to provide
> > >>> the implementation of the printf function, and that implementation
> > >>> implements "%a" and "%A", but does so incorrectly. That's a bug in
> > >>> that particular version of msvcrt.dll (and in your implementation).
> > >>>
> > >>> (The output is likely enough to distinguish between adjacent
> > >>> floating-point values (I haven't verified that), but not enough to
> > >>> represent the value exactly, which is what the standard requires.)
> > >>
> > >> This is actually something I hadn't considered. If the purpose of %A is
> > >> a 100% accurate representation of the whole number, then those 7 digits
> > >> shown by msvcrt.dll are not enough, and it is wrong.
> > >
> > > MSVCRT.DLL is a system library you're not supposed to use.
> >
> > And yet, nearly every other program uses it. Including gcc.exe of mingw:
> Yes; by doing that, they are perpetrating a poor practice.
>
> It's a good reason to stay away from the MinGW project.
> --
> TXR Programming Language: http://nongnu.org/txr
> Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
> Mastodon: @Kazi...@mstdn.ca

Mingw64 provides ucrt64 build environment.
I tried it few minutes ago, it appears to work fine.
So, one can chose perpetrating a poor practice with MinGW, but one
does not have to. For those interested, MinGW provides supposedly better
alternative.

Personally, I use msys2/mingw64 for cross-development and for experimentation,
so I care very little about distribution of compiled binaries on Windows platform.
But may be now, after seeing that ucrt build environment works, I'd start to
use it for experimentation instead of "classic" MinGW64 since I see no downsides.

Re: you think rust may outthrone c?

<uavu3s$3tr9o$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36527&group=comp.lang.c#36527

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.2a02:2121:283:e4b7:3c12:e658:940e:979a!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 9 Aug 2023 13:42:51 +0200
Organization: A noiseless patient Spider
Message-ID: <uavu3s$3tr9o$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<d124c512-5586-444e-9252-72e601502eaen@googlegroups.com>
<uaddgc$1lf7$1@dont-email.me>
<d7fcd0d6-c5a5-4229-87d5-98f3129c9572n@googlegroups.com>
<87wmydv39y.fsf@bsb.me.uk>
<c707dddd-c94e-47bf-9ae6-a8537d245ac1n@googlegroups.com>
<uaeivj$9urb$1@dont-email.me>
<27a833dc-67b7-4195-a3f5-8d8c60ad3d2fn@googlegroups.com>
<uafsqe$mtv7$1@dont-email.me> <X=vUTZgAAVQwBn6et@bongo-ra.co>
<uaj4gk$1alq7$1@dont-email.me>
<cbe7d004-e90b-41d7-9a34-c711ef9c3949n@googlegroups.com>
<uaj7iv$1b5h7$1@dont-email.me>
<2caab55a-f70e-457f-a4d2-ee912c27b681n@googlegroups.com>
<ualceb$1nnq7$1@dont-email.me>
<1aceef78-a719-424e-9234-63bc7531105cn@googlegroups.com>
<uatmcb$3eti9$1@dont-email.me>
<a33ce226-3826-4b0c-97fc-585105018304n@googlegroups.com>
<uatrg9$3fncp$1@dont-email.me>
<2eb60e6c-5f68-40fb-afef-c41ca8bb3683n@googlegroups.com>
<uaufeh$3iq7v$1@dont-email.me>
<169226c1-5531-4ea1-856b-f46ad0aeaf43n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 9 Aug 2023 11:42:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2a02:2121:283:e4b7:3c12:e658:940e:979a";
logging-data="4123960"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.6.1
In-Reply-To: <169226c1-5531-4ea1-856b-f46ad0aeaf43n@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Wed, 9 Aug 2023 11:42 UTC

On 09/08/2023 05:23, Malcolm McLean wrote:
> On Tuesday, 8 August 2023 at 23:26:47 UTC+1, David Brown wrote:
>> On 08/08/2023 19:04, Malcolm McLean wrote:
>>> On Tuesday, 8 August 2023 at 17:46:15 UTC+1, David Brown wrote:
>>>> On 08/08/2023 18:04, Malcolm McLean wrote:
>>>>> On Tuesday, 8 August 2023 at 16:18:49 UTC+1, David Brown wrote:
>>>>>> On 05/08/2023 14:08, Malcolm McLean wrote:
>>>>>>
>>>>>>> This is the problem of course. The Baby X API expects data in a certain format.
>>>>>>> So all the API functions which operate on images take a 32 bit RGBA buffer
>>>>>>> as an "unsigned char *", and the dimensions as two ints. But another API might
>>>>>>> use an opaque "IMAGE" structure. Or another system might have 16 bit r5g5b5a1
>>>>>>> images.
>>>>>>
>>>>>> It would make a lot of sense to have a program that took data in common
>>>>>> standardised uncompressed forms (like .wav, .bmp) and generated data in
>>>>>> whatever format suits Baby X.
>>>>>>
>>>>> "Data" means, "that which is given". People programming applications are given
>>>>> resources in many formats. They might steal a PNG from the web, get a JPEG
>>>>> commissioned from a paid artist, knock up their own SVG.
>>>>> Now of course it's possible to convert all these into a common format like PNG
>>>>> which is powerful enough to hold all thse formats without loss. But you've lost
>>>>> the link with the original data. So when the artist comes back with a second
>>>>> version of the JPEG, you've got to run ImageMagick again. And I don't have
>>>>> ImageMagick installed on the Mac I'm writing this on (there's a program called
>>>>> sips which does similar things).
>>>>> A resouce pipeline with lots of stages, each one requiring a separate third party
>>>>> program, is quite fragile. It works for as long as your Linux machine is all set up
>>>>> with the dependencies, which will be the case for the duration of the project.
>>>>> But if you archive it, and dust it off years later, will things still be intact? And
>>>>> will you know which are the intermediate files, and which are the original data?
>>>> It looks like there is someone else in this group who could benefit from
>>>> understanding "make" and/or other build tools. And if you can't use a
>>>> Mac for development, scrap the expensive toy and install a usable
>>>> system. (Of course, you /can/ use a Mac for development - you just need
>>>> to know how to use your tools.)
>>>>
>>> Bart's right about make. If it actually worked properly we wouldn't need CMake.
>> "make" works perfectly well for its purpose. CMake is a different tool,
>> doing a different job. In fact, CMake generates makefiles for use by
>> "make" (as well as project files for MSVC, and other types of build
>> system). CMake is a higher level tool. ("make" can, in combination
>> with compilers like gcc, do a fair amount of higher level work as well,
>> such as tracking dependencies and files automatically.)
>>
> CMake is an alternative to make.

It is a "meta-build" tool, aimed at a higher level than make, and which
generates scripts or control files for various uses - makefiles, MSVC
project files, and others. For some kinds of project, that might be a
good choice - sometimes it makes sense to separate the tasks of
calculating dependencies and settings, and actually controlling the
build. But since on many platforms CMake depends on make, it is not an
alternative. And CMake is not flexible enough for many uses - when I
have looked at it, it was not remotely flexible enough to do the kinds
of things I do with make. Many people use CMake, so it must have
merits, but it is not a replacement for make.

> It can generate make files, in fact that's the
> default. Which means that if you ship a project with a CMake script, you
> wouldn't normally provide a make file. CMake found a niche largely because
> make files are too difficult to use. The other reason is that the big IDEs
> rejected makefiles as their format for describing how to build projects.

Every IDE of any quality can handle projects that are built using
external makefiles. An IDE that won't run "make" at the press of a
hotkey is as useful as an IDE that can't handle ASCII format test files.

But if you have an external manually written makefile, that is not
project management - so usually you also then have to make an IDE
project to describe the source files, include search paths, pre-defined
macros, etc. That can be a duplicate of work (though good makefiles
find the source files and dependencies mostly automatically), and
duplication can lead to mistakes.

The norm AFIK for build systems controlled by IDEs is make - they
generate makefiles automatically based on your project settings, dialog
boxes for choosing compiler flags, etc. Such systems can work
reasonably well, though a well-made manual makefile is often much better
at calculating dependency information for large projects.

Some IDEs may generate CMake files, then run CMake, then make - I have
(unsurprisingly) not used all IDEs.

CMake, as far as I understand it, is popular when you want a project to
build on Linux with gcc and Windows with MSVC - that is its niche.

>>
>> One thing that "make" is particularly good at is chains of processes.
>> It is straightforward to say that "picture.o" is compiled from
>> "picture.c" which is resource-compiled from "picture.bmp" which is
>> converted from "picture.jpg". I sometimes have that kind of thing in
>> makefiles for building documentation, where the graphics files I want to
>> add to my LaTeX documents might need conversions or manipulations from
>> the originals.
>>
>>> But it's unmaintainable.
>>
>> Not for people who are familiar with it.
>>
> Many programmers might start a new project only once every two years. And
> it might not be their job to write the makefile. So they are not going to be very
> familiar with make. Maintainable software needs to be maintainable by people
> who don't have a deep familarity with it. I can debug Cmake scripts despite
> not really knowing the CMake language, because it's close enough to a normal
> procedural programming language for someone who can program but doesn't
> know CMake specifically to follow along.

People need to know how to use their tools. Within any development
group, you need people who can handle the different parts of the
development process. Sometimes people can do it all, sometimes there
are specialists in the group. So someone might be an expert at git,
someone at make, different programmers can handle different languages,
and others are good at design, documentation, testing, and all the other
aspects of software development. Anyone who thinks that "understands C"
is the be-all and end-all of making and maintaining a software project
in C is doomed to failure.

So if you are part of a development team, and your team is rejecting
"make" on the basis of "it's too hard to understand", your development
team is in a /lot/ of trouble. New management - or at least training
for the management - should be number one priority until the job is run
by people that understand about using the best tools for the job, and
training people in the jobs that need done. (Of course, if CMake really
is a better choice for your project, that's fine - make is not the only
tool in the box.)

>>
>> Certainly complicated makefiles are harder to deal with than simple
>> ones. It's a powerful tool with many features, and takes time and
>> effort to learn. But complicated ones can reduce maintenance - my
>> makefiles do not need modification as files are added or removed from a
>> project, or dependencies on headers change - it is all handled
>> automatically.
>>
>>> Baby X is mainly for small hobby type programs. It's easier to use than
>>> the raw X11 interface, and it's far lighter weight than Qt or GTK. It also
>>> ports to Windows. So most of the users will be bedroom programmers
>>> who will set up the internationalisation strings themselves, rather than
>>> employing professional translators.
>> That is a hopeless attitude to take. You are simply guaranteeing that
>> people will not use it for internationalisation - or that they will hate
>> the tool when they try to use it. Targeting hobby users is not an
>> excuse for bad design. I would suggest you remove all traces of
>> internationalisation until you have found a way to make it work. (And
>> drop the XML format while you are at it - a simple one line, one command
>> text format would be vastly easier for everyone.)
>>
> It works.


Click here to read the complete article
Re: you think rust may outthrone c?

<0f31b7b5-6f47-46b8-95b5-1ef7a055041dn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36528&group=comp.lang.c#36528

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:7d8d:0:b0:403:2e4c:28a6 with SMTP id c13-20020ac87d8d000000b004032e4c28a6mr45139qtd.3.1691583056410;
Wed, 09 Aug 2023 05:10:56 -0700 (PDT)
X-Received: by 2002:a05:6a00:3a15:b0:687:a55f:a9ef with SMTP id
fj21-20020a056a003a1500b00687a55fa9efmr166861pfb.2.1691583055670; Wed, 09 Aug
2023 05:10:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 9 Aug 2023 05:10:55 -0700 (PDT)
In-Reply-To: <rpCAM.87315$ftCb.76427@fx34.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=199.203.251.52; posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 199.203.251.52
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uaeul9$b81t$1@dont-email.me> <87r0okvrht.fsf@bsb.me.uk> <uag05n$nmu5$1@dont-email.me>
<uagcgc$ppbn$1@dont-email.me> <87fs50ulog.fsf@bsb.me.uk> <uagpni$rt71$1@dont-email.me>
<87r0ohrvg0.fsf@bsb.me.uk> <uamlh1$1tr9i$1@dont-email.me> <875y5tkptn.fsf@bsb.me.uk>
<uans1e$26toe$1@dont-email.me> <87cyzzkfxh.fsf@nosuchdomain.example.com>
<uap5e6$2gd8e$1@dont-email.me> <87350vke4n.fsf@nosuchdomain.example.com>
<uap73l$2gktp$1@dont-email.me> <87y1initxx.fsf@nosuchdomain.example.com>
<uapf90$2ht0t$1@dont-email.me> <87leenirja.fsf@nosuchdomain.example.com>
<uaqdst$2q82c$1@dont-email.me> <8M4AM.510037$TPw2.337804@fx17.iad>
<uaqqou$2sa5t$1@dont-email.me> <87wmy6j37n.fsf@bsb.me.uk> <uara1m$2uq73$1@dont-email.me>
<20230807125815.939@kylheku.com> <uas273$32k64$1@dont-email.me>
<2FhAM.351580$xMqa.250758@fx12.iad> <uat7ht$3camf$1@dont-email.me>
<qsqAM.133251$f7Ub.122358@fx47.iad> <uatimv$3e73n$1@dont-email.me> <rpCAM.87315$ftCb.76427@fx34.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0f31b7b5-6f47-46b8-95b5-1ef7a055041dn@googlegroups.com>
Subject: Re: you think rust may outthrone c?
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Wed, 09 Aug 2023 12:10:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Michael S - Wed, 9 Aug 2023 12:10 UTC

On Wednesday, August 9, 2023 at 4:59:01 AM UTC+3, Richard Damon wrote:
> On 8/8/23 10:16 AM, Bart wrote:
> > On 08/08/2023 13:22, Richard Damon wrote:
> > > On 8/8/23 7:05 AM, Bart wrote:
> > >> On 08/08/2023 03:21, Richard Damon wrote:
> > >> > On 8/7/23 8:28 PM, Bart wrote:
> > >> >> My view is that C's print-format system is not fit for purpose. The
> > >> >> formatting is OK, it is needing to specify types that is the
> > problem.
> > >> >
> > >> > which is EXACTLY the arguement that got us the C++ stream <<
> > operator.
> > >> That feature is so bad it makes using printf preferable! Is it really
> > >> that hard to just be able to write 'print x' ?
> > >>
> > >> > If you want to do that in C, you can, just define a generic "print"
> > >> > function that defines version for each fundamental type, and call
> > >> that.
> > >> >
> > >> > You don't seem to understand that C is based on the assumption that
> > >> the
> > >> > programmer actually knows what he is doing, not hiding behind a
> > >> mass of
> > >> > abstractions.
> > >>
> > >> You don't get my point. The programmer might not know for sure the
> > >> type of a complex expression, and certainly does not want to keep
> > >> updating dozens of printf formats across the codebase as global
> > >> declarations change.
> > >
> > > Then they are using the wrong tool.
> >
> > What tool did you have in mind? Do you mean that an IDE will tell you
> > the types of the expressions, or write the format codes for you?
>
> IF you actually want to output expressions that you don't know the type,
> you need something that supports that. Maybe C++, maybe Python, maybe
> something else like that.
>
> It seems you have one tool in your box, so everything is a nail.
>
> >
> > That strikes me as the same argument that you can use CDECL to get round
> > abstruse C type specs. If the tool can do it, why doesn't the compiler?
> > Or the language.
>
> Except the issue you are describing isn't handled by CDECL. That
> generally needs the fully expressed type, and you complaint seems to be
> a type that has been hidden via typedefs and the like.
>
> So CDECL doesn't do what you want.
>
> >
> > > C is designed to be used when you know, at least in general, what you
> > > are working with.
> > >
> > >>
> > >> Right now I don't know how to print a clock() result for example, and
> > >> to keep inventing special formats like %zu is crass.
> > >>
> > >> *I* can just write:
> > >>
> > >> println a, b, c
> > >
> > > So, why don't you?
> >
> > I do. It's lovely. The question is, why are a million users of C denied
> > that?
>
> Because that isn't C. If you want basic, you know where to find it.
>
> Note, "println" like that can't do a lot of things that printf can do
> when properly used, so it becomes the problem of just using the right tool.
>
> >
> > > is the problem that you don't know how to translate that into C?
> > >
> > >>
> > >> So can a dozen other languages (even from the 1960s!). I can change
> > >> the types of a, b, c, and it still works. I can print c, b, a and it
> > >> still works.
> > >>
> > >> I can even just do 'print clock()'!
> > >>
> > >> In C YOU CAN'T DO THAT. You need to dig up the types of each
> > >> expression and apply the right format. In this VERY simple case, it
> > >> MIGHT be:
> > >
> > > Because C is a lower level, and targeted to be more efficiet, than those
> > > other languages.
> >
> > Sorry, but that is rubbish. My 'M' language is also low level, but
> > somehow manages to have a proper print. And it's not dead slow either:
>
> And I bet it only runs on x86 processors?
>
>
> >
> > A loop which prints the numbers up to 10 million (redirected to a file
> > to remove display overheads), takes 1.8 seconds in my language, and 3.2
> > seconds using gcc 13.2 -O3. bcc/tcc take 2.4 seconds.
> >
> > (My library is faster, despite the int->text code being unoptimised,
> > because of buffering. But then maybe gcc's printf is also buffered
> > internally. Which one is cheating more? I know mine won in this case!)
>
> Maybe you used the wrong C library to do that.
>

Then what would you suggest for right library ?
I tested four very popular options - old MS DLL, modern MS DLL, modern
MS static lib (on x86-64 Windows) and modern glibc .so (on x86-64 Linux).
They all were slow, 2-3 times slower than simple unoptimised C code posted
below. MS static lib the least bad of the slow lot.

int int_to_str(char* dst, int ix)
{ if (ix == 0) {
dst[0] = '0';
dst[1] = 0;
return 1;
}

char* beg = dst;
unsigned ux = ix;
if (ix < 0) {
*dst++ = '-';
ux = -ix;
}
char* tsd = dst;
do {
unsigned nxt = ux / 10;
*tsd++ = (char)(ux - nxt*10 + '0');
ux = nxt;
} while (ux != 0);
*tsd = 0;
int ret = (int)(tsd - beg);

--tsd;
while (tsd > dst) {
char a = *dst;
char b = *tsd;
*tsd = a;
*dst = b;
--tsd;
++dst;
}

return ret;
}

And my estimate is that with sufficient effort this unoptimized code can
be improved at least by another factor of 3, but quite possible even 5.

> Also, since you have shown that you format routines don't meet the full
> functionality of C's, that will give it an advantage.
>

Yes, I think it is a big part of the problem. printf interface is very flexible
which turns even good implementations into non-competitive with what
can be easily achieved with simpler API as one of Bart's.
Alternatives with simpler interfaces, e.g. itoa() exist, but not in Standard.

> >
> >
> > >>
> > >> printf("%lld " PRId64 " %s", a, b, c);
> > >>
> > >> But now you have an extra maintenance headache.
> > >>
> > >> (In all cases, printing gets untidy when you need to do necessary
> > >> formatting, but only C incorporates types into the formatting.)
> > >>
> > >>
> > >> >> It gets tricky when using sprintf say from another language,
> > which is
> > >> >> then transpiled to actual C.
> > >> >
> > >> > And why doesn't that other language implement a better print
> > >> > functionality itself?
> > >>
> > >> It does, but ultimately it needs to do I/O, and I've been using C's
> > >> printf for that since the mid-90s, because it was simpler than using
> > >> WinAPI. I've since forgotten how do it with WinAPI.
> > >
> > > So, your problem is that you aren't willing to do the work yourself.
> >
> > What problem is this? I've been implementing 'proper' PRINT in languages
> > since as far back as 1981.
>
> Then why are you complaining that the C printf doesn't meet your
> requireents?
>
> >
> > At some point, nearly 20 years later, I switched from OS to C functions
> > for low-level I/O, for consoles or files. For Printing to printers,
> > images, windows and strings, I still handled that.
>
> So?
>
> You added a layer of abstraction, so maybe you programs can run on more
> targets.
>
> >
> > > So again, the problem is you are using the wrong tool or your language
> > > is incomplete.
> >
> > The problem is that you don't have a clue what the problem is.
>
> No, I fully understand it.
>
> >
> > There is no tool, and no feature in my language (other than turning it
> > into C), that will fix the problem that C's 'char*' is so unique.
>
> Why is C's char* being unique a problem?
>
> It still sounds like the problem is you don't understand what C is
> doing, so you are misusing it.
>
> >
> > Usually you can ignore that if using C's library purely via a binary
> > interface, but if generating C code, you will see issues. The solutions
> > are ugly and ungainly.
>
> But "intermediary" output is almost always "ugly", that is part of the
> nature of machine generated code. If you "compilation" is any good, no
> one needs to look at it.
>
> >
> > Try it and see!
> >
> > > But to use C as a portable assembler, you need to use it as an
> > > assembler, and that means understanding the nature of the "assembly
> > > language".
> >
> > An assembly language which has a million more rules, special cases and
> > UBs than any real assembler!
>
> Your thinking about the wrong machine. Remember, in C, the machine you
> need to be thinking about is the "abstract machine" defined by the standard.
>
> >
> > In x64 assembly, I can write a floating point value to a 64-bit memory
> > location, and read it back as an integer, with no issues:
> >
> > movq [fred], xmm0
> > mov rax, [fred]
> >
> > C makes that undefined - maybe.
>
> So?
>
> >
> > > IF you are concerned about efficient outputing of valuse, you build a
> > > family of generic "print" functions that use the right version for the
> > > type given, and let the complier figure it out. Just means you can't put
> > > everything in one statement. (but this is intermediary code, so doesn't
> > > really need to be totally readable).
> >
> > This is exactly what I do behind the scenes of my language. And another
> > reason why I sometimes use 'printf', since it produces long sequences of
> > function calls which obscure minimal test code.
> >
> > The advantage of printf also is that it is outside my language, so its
> > implementation code doesn't intrude.
> >
>
> And if the doesn't meet your requirements, don't use it.
>
> One big aspect of printf, is you need to know the "type" of each
> arguement you give it. If you do, it works well, if you don't you just
> can't use it.
>
> You seem to think this is a bug instead of its design decision.
>
> Try to explain how you would change C so that printf could be more
> forgiving on the type given to it without totally changing how the
> language works.
>
> Remember, "printf" isn't something special in the language, and you can
> write your own equivalent function, which would need to be able to work
> just the same.


Click here to read the complete article
Re: you think rust may outthrone c?

<ub00ij$3uknp$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36529&group=comp.lang.c#36529

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.2a02:2121:283:e4b7:7c85:8d51:fa3c:b561!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: you think rust may outthrone c?
Date: Wed, 9 Aug 2023 14:24:49 +0200
Organization: A noiseless patient Spider
Message-ID: <ub00ij$3uknp$1@dont-email.me>
References: <ebb9e01a-6369-4629-8b38-11d28df63693n@googlegroups.com>
<uab5ja$3mc91$1@dont-email.me> <uabeq1$3nigh$1@dont-email.me>
<uabobj$3oias$1@dont-email.me>
<d124c512-5586-444e-9252-72e601502eaen@googlegroups.com>
<uaddgc$1lf7$1@dont-email.me>
<d7fcd0d6-c5a5-4229-87d5-98f3129c9572n@googlegroups.com>
<87wmydv39y.fsf@bsb.me.uk>
<c707dddd-c94e-47bf-9ae6-a8537d245ac1n@googlegroups.com>
<uaeivj$9urb$1@dont-email.me>
<27a833dc-67b7-4195-a3f5-8d8c60ad3d2fn@googlegroups.com>
<uafsqe$mtv7$1@dont-email.me> <X=vUTZgAAVQwBn6et@bongo-ra.co>
<uaj4gk$1alq7$1@dont-email.me>
<cbe7d004-e90b-41d7-9a34-c711ef9c3949n@googlegroups.com>
<uaj7iv$1b5h7$1@dont-email.me>
<2caab55a-f70e-457f-a4d2-ee912c27b681n@googlegroups.com>
<ualceb$1nnq7$1@dont-email.me>
<1aceef78-a719-424e-9234-63bc7531105cn@googlegroups.com>
<uatmcb$3eti9$1@dont-email.me>
<a33ce226-3826-4b0c-97fc-585105018304n@googlegroups.com>
<87bkfhqfqx.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 9 Aug 2023 12:24:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2a02:2121:283:e4b7:7c85:8d51:fa3c:b561";
logging-data="4150009"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.6.1
In-Reply-To: <87bkfhqfqx.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: David Brown - Wed, 9 Aug 2023 12:24 UTC

On 09/08/2023 01:24, Keith Thompson wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> [...]
>> You can't really support Unicode but not support internationalisation,
>> however.
> [...]
>
> An application could show all its application-defined messages in
> English, but still handle and display arbitrary text in any language.
> A word processor that uses English for all its messages and commands
> can still be used to write a novel in French.
>

And some words in English need non-ASCII characters to be spelt
correctly, such as naïve or café. People's names might have non-ASCII
characters - how is Mr. π·r² going to write his name in an application
that does not support Unicode?

And a Mongolian only application would want Unicode, but would not
support internationalisation.

Yes, Unicode is useful without internationalisation of an application.


devel / comp.lang.c / Re: you think rust may outthrone c?

Pages:123456789101112131415161718192021222324252627282930313233343536373839
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor