Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

I've noticed several design suggestions in your code.


devel / comp.lang.c / C vs Haskell for XML parsing

SubjectAuthor
* C vs Haskell for XML parsingMalcolm McLean
+* Re: C vs Haskell for XML parsingBart
|+* Re: C vs Haskell for XML parsingBen Bacarisse
||`* Re: C vs Haskell for XML parsingMalcolm McLean
|| `* Re: C vs Haskell for XML parsingBen Bacarisse
||  `* Re: C vs Haskell for XML parsingMalcolm McLean
||   `* Re: C vs Haskell for XML parsingBen Bacarisse
||    +* Re: C vs Haskell for XML parsingMalcolm McLean
||    |`- Re: C vs Haskell for XML parsingBen Bacarisse
||    `* Re: C vs Haskell for XML parsingMalcolm McLean
||     +- Re: C vs Haskell for XML parsingLew Pitcher
||     +* Re: C vs Haskell for XML parsingScott Lurndal
||     |+* Re: C vs Haskell for XML parsingLew Pitcher
||     ||+- Re: C vs Haskell for XML parsingLew Pitcher
||     ||`- Re: C vs Haskell for XML parsingScott Lurndal
||     |`* Re: C vs Haskell for XML parsingBen Bacarisse
||     | `- Re: C vs Haskell for XML parsingScott Lurndal
||     `* Re: C vs Haskell for XML parsingBen Bacarisse
||      `* Re: C vs Haskell for XML parsingMalcolm McLean
||       +- Re: C vs Haskell for XML parsingRichard Damon
||       `* Re: C vs Haskell for XML parsingBen Bacarisse
||        `* Re: C vs Haskell for XML parsingMalcolm McLean
||         +- Re: C vs Haskell for XML parsingKeith Thompson
||         `* Re: C vs Haskell for XML parsingBen Bacarisse
||          +* Re: C vs Haskell for XML parsingMalcolm McLean
||          |`- Re: C vs Haskell for XML parsingBen Bacarisse
||          `* Re: C vs Haskell for XML parsingDavid Brown
||           +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |`* Re: C vs Haskell for XML parsingDavid Brown
||           | `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |  `* Re: C vs Haskell for XML parsingDavid Brown
||           |   +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   |+* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   || `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||  `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||   `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||    `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     +* Re: C vs Haskell for XML parsingBart
||           |   ||     |`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     | `- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     +* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     | +- Re: C vs Haskell for XML parsingScott Lurndal
||           |   ||     | `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |  `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |   `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |    `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |     +* Re: C vs Haskell for XML parsingBart
||           |   ||     |     |+* Re: C vs Haskell for XML parsingKaz Kylheku
||           |   ||     |     ||`- Re: C vs Haskell for XML parsingKaz Kylheku
||           |   ||     |     |`- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |     `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      |+* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      ||+* Re: C vs Haskell for XML parsingScott Lurndal
||           |   ||     |      |||`* Re: C vs Haskell for XML parsingLew Pitcher
||           |   ||     |      ||| `* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      |||  `- Re: C vs Haskell for XML parsingLew Pitcher
||           |   ||     |      ||+* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      |||`* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      ||| `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      |||  `- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      ||`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || +* Re: C vs Haskell for XML parsingScott Lurndal
||           |   ||     |      || |`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || | +- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || | `* Re: C vs Haskell for XML parsingJames Kuyper
||           |   ||     |      || |  +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  |+* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || |  ||`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  || `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || |  ||  `* Re: C vs Haskell for XML parsingKaz Kylheku
||           |   ||     |      || |  ||   +- Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  ||   `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || |  ||    `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  ||     `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || |  ||      `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  ||       `- Re: C vs Haskell for XML parsingTim Rentsch
||           |   ||     |      || |  |+* Re: C vs Haskell for XML parsingKaz Kylheku
||           |   ||     |      || |  ||`- Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  |+- Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      || |  |`- Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      || |  `- Re: C vs Haskell for XML parsingScott Lurndal
||           |   ||     |      || `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      ||  `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      ||   +- Re: C vs Haskell for XML parsingChris M. Thomasson
||           |   ||     |      ||   `- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      |`* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      | +* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | |+* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||+* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | |||+- Re: C vs Haskell for XML parsingBen Bacarisse
||           |   ||     |      | |||+* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||||`* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | |||| `* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||||  `* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | ||||   `* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||||    `* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | ||||     `* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||||      `* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | |||`- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      | ||`* Re: C vs Haskell for XML parsingBart
||           |   ||     |      | |`* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      | `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      +- Re: C vs Haskell for XML parsingSpiros Bousbouras
||           |   ||     |      +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      +* Underscores in type names (was : C vs Haskell for XML parsing)Spiros Bousbouras
||           |   ||     |      +* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      `- Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     `- Re: C vs Haskell for XML parsingKeith Thompson
||           |   |`- Re: C vs Haskell for XML parsingScott Lurndal
||           |   `- Re: C vs Haskell for XML parsingBart
||           `- Re: C vs Haskell for XML parsingBen Bacarisse
|+* Re: C vs Haskell for XML parsingfir
|`* Re: C vs Haskell for XML parsingKaz Kylheku
+- Re: C vs Haskell for XML parsingBen Bacarisse
+- Re: C vs Haskell for XML parsingfir
`* Re: C vs Haskell for XML parsingfir

Pages:123456789101112
Re: C vs Haskell for XML parsing

<ucn6t5$2n2kb$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 12:50:13 +0200
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <ucn6t5$2n2kb$2@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<ucfusp$18cb9$3@dont-email.me> <87pm38cihm.fsf@nosuchdomain.example.com>
<uchno8$1kjtk$1@dont-email.me> <87pm36byty.fsf@nosuchdomain.example.com>
<uckvi2$29oe0$2@dont-email.me> <871qflbob8.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 30 Aug 2023 10:50:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="539bf0dd710ca1705ea132369b4acf0f";
logging-data="2853515"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1926fgcys/nBQTNJ/qAOtV78kszI/xS46k="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:1KFq6U0qQpvsQxlGzN4IN0WhLQo=
Content-Language: en-GB
In-Reply-To: <871qflbob8.fsf@nosuchdomain.example.com>
 by: David Brown - Wed, 30 Aug 2023 10:50 UTC

On 29/08/2023 22:12, Keith Thompson wrote:
> David Brown <david.brown@hesbynett.no> writes:

>> But rather than adding new ways to get inconsistent or undefined
>> behaviour, I would prefer taking the opportunity to make it harder to
>> get inconsistent or undefined behaviour here. We can't force people
>> to write good code, or to stop writing bad code - but we /can/
>> encourage it.
>
> Not if the additional changes intended to make the feature harder to
> abuse make it harder to use (and harder to explain).
>

Agreed. There are always balances and trade-offs involved. I do not
claim to know an "ideal" solution here (especially since "ideal" will
vary wildly for different people). But I think it should be an
important part of the discussion and consideration before implementing
such new features. In the end, I would expect to see the rules being
looser than I personally would prefer, and hope to see compilers provide
warnings or other flags to let people enforce tighter rules if they want.

Re: C vs Haskell for XML parsing

<fb65da9e-a175-4e9d-8749-b5d45e5ceeb3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:398a:b0:76f:f5f:f0ba with SMTP id ro10-20020a05620a398a00b0076f0f5ff0bamr56224qkn.5.1693397051664;
Wed, 30 Aug 2023 05:04:11 -0700 (PDT)
X-Received: by 2002:a05:620a:628e:b0:76e:e858:3511 with SMTP id
ov14-20020a05620a628e00b0076ee8583511mr40841qkn.6.1693397051402; Wed, 30 Aug
2023 05:04:11 -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, 30 Aug 2023 05:04:11 -0700 (PDT)
In-Reply-To: <ucn5ni$2mv5b$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:acb0:8b48:1f24:c4e8;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:acb0:8b48:1f24:c4e8
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com> <uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com> <87pm3bot1n.fsf@bsb.me.uk>
<7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com> <ucdcaf$mj8h$1@dont-email.me>
<627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com> <ucftjs$186cs$1@dont-email.me>
<gN1HM.144949$ftCb.130257@fx34.iad> <86il8ywyu5.fsf@linuxsc.com>
<uck607$2563l$1@dont-email.me> <20230829121430.516@kylheku.com>
<uclinu$2cs9n$1@dont-email.me> <62855ccd-0d2c-431f-b776-f8f84eb58a4an@googlegroups.com>
<ucn5ni$2mv5b$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fb65da9e-a175-4e9d-8749-b5d45e5ceeb3n@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Wed, 30 Aug 2023 12:04:11 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Malcolm McLean - Wed, 30 Aug 2023 12:04 UTC

On Wednesday, 30 August 2023 at 11:30:26 UTC+1, David Brown wrote:
> On 30/08/2023 09:43, Malcolm McLean wrote:
> > On Tuesday, 29 August 2023 at 21:00:14 UTC+1, David Brown wrote:
> >> On 29/08/2023 21:22, Kaz Kylheku wrote:
> >>> On 2023-08-29, David Brown <david...@hesbynett.no> wrote:
> >>>> On 29/08/2023 01:07, Tim Rentsch wrote:
> >>>>> sc...@slp53.sl.home (Scott Lurndal) writes:
> >>>>>
> >>>>>> I will use [underscore] in preference to CamelCase, which I dislike
> >>>>>> primarily because of the impact on my typing speed.
> >>>>>
> >>>>> In most cases I find CamelCase harder to read than using
> >>>>> underscores, especially when using mono-spaced fonts.
> >>>>
> >>>> I used to use camelCase for most of my identifiers - now I find I am
> >>>> using underscores much more, precisely because I find it easier to read.
> >>>> I strongly suspect it is age-related - camelCase was more appealing
> >>>> when my eyes were younger.
> >>>
> >>> CamelCase is at odds with the C language. It is not used in the standard
> >>> library, and it's not used in the related POSIX standard which comes
> >>> from the same birthplace.
> >>>
> >> Nonsense. Just because it is not used in the C standard library or
> >> POSIX does not make it "at odds with the C language". It might be more
> >> common in other languages than C, but it's fine for identifiers in C.
> >>
> > It's not in itself a knockdown, conclusive argument.
> > But it's a good argument. Match the standard library house style.
> It is not even remotely close to being a good argument.
>
> Consistency of style within a project, library, team, etc., is important
> and makes the code easier to write, easier to read, and easier to use.
> That's why projects or teams often have style guides.
>
> But there are no advantages in following a style from a different
> project. If you are contributing to the C standards, or an extended
> version of the C standard library, then follow the style for the C
> standard library - no word separators for short function names,
> underscores for long function names and macros, _t for types, etc. Most
> people, however, are /not/ writing code for the C standard library, and
> thus the style of the C standard library should not influence style for
> their own code.
>
You call the standard library in most C projects.
So the argument is that you should match the standard library style.
The alternative argument is that you should deliberately not match
the standard library style, to make it obvious which calls are standard
library calls and which are not.

Re: C vs Haskell for XML parsing

<ucnkde$2op2r$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 14:40:46 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 69
Message-ID: <ucnkde$2op2r$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com>
<87pm3bot1n.fsf@bsb.me.uk>
<7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com>
<ucdcaf$mj8h$1@dont-email.me>
<627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com>
<ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad>
<86il8ywyu5.fsf@linuxsc.com> <uck607$2563l$1@dont-email.me>
<20230829121430.516@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 30 Aug 2023 14:40:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="979466420f7fea7960bdd457fef98170";
logging-data="2909275"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19T/hGA4E29A7ua+h58gDC5RTN9wLHhp0o="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:d0g/G3br55/AQifEwg+v42HJqxc=
 by: Lew Pitcher - Wed, 30 Aug 2023 14:40 UTC

On Tue, 29 Aug 2023 19:22:09 +0000, Kaz Kylheku wrote:

> On 2023-08-29, David Brown <david.brown@hesbynett.no> wrote:
>> On 29/08/2023 01:07, Tim Rentsch wrote:
>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>
>>>> I will use [underscore] in preference to CamelCase, which I dislike
>>>> primarily because of the impact on my typing speed.
>>>
>>> In most cases I find CamelCase harder to read than using
>>> underscores, especially when using mono-spaced fonts.
>>
>> I used to use camelCase for most of my identifiers - now I find I am
>> using underscores much more, precisely because I find it easier to read.
>> I strongly suspect it is age-related - camelCase was more appealing
>> when my eyes were younger.
>
> CamelCase is at odds with the C language.

I would disagree. CamelCase (as in identifiers consisting of a mix of
upper and lower case characters) is inherent in the definition of an
identifier, and has been since K&R C. The /language/ imposes no
restriction on the use of CamelCase (although, in "The C Programming
Language", K&R did note that "the underscore ... is useful for improving
the readability of long variable names").

> It is not used in the standard
> library, and it's not used in the related POSIX standard which comes
> from the same birthplace.

That may be more because of the compilation environment than because
of the language standards.

Remember, when the code that we now call the C standard library, and
the facilities that we now call the POSIX standard were initially
developed, the C language /implementations/ were limited by the
underlying host environment's restrictions on external names.

Some environments imposed a single case on external names (usually,
upper case only), so Strcmp() and strcmp(), while naming different
functions, would both resolve to the external name STRCMP. Kernighan,
Plauger, Ritchie, et al likely avoided mixed case external names
in the C and UNIX libraries for this reason alone.

> It's not used, or rarely used, in Unix file naming conventions,
> or for naming anything in the shell environment.

But, /not/ discouraged or forbidden.

> Makefile has an M just to put it ahead of lower-cased filenames
> in the lexicographic listing

Can you provide a definitive reference for that assertion?
I note that the 1978 Bell Labs version of make(1) read it's
dependency list from a file called "makefile"[1]. I do not
know when that changed to "Makefile".

> (which would not work if files had names
> like Parser.c and UserInterface.c.)

[snip]

[1] "Make - A Program for Maintaining Computer Programs"
S. I. Feldman, Bell Laboratories, August 15, 1978

--
Lew Pitcher
"In Skills We Trust"

Re: C vs Haskell for XML parsing

<HSIHM.817959$AsA.222853@fx18.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: C vs Haskell for XML parsing
Newsgroups: comp.lang.c
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com> <87pm3bot1n.fsf@bsb.me.uk> <7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com> <ucdcaf$mj8h$1@dont-email.me> <627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com> <ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad> <86il8ywyu5.fsf@linuxsc.com> <uck607$2563l$1@dont-email.me> <20230829121430.516@kylheku.com> <ucnkde$2op2r$1@dont-email.me>
Lines: 38
Message-ID: <HSIHM.817959$AsA.222853@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 30 Aug 2023 15:03:03 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 30 Aug 2023 15:03:03 GMT
X-Received-Bytes: 2151
 by: Scott Lurndal - Wed, 30 Aug 2023 15:03 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>On Tue, 29 Aug 2023 19:22:09 +0000, Kaz Kylheku wrote:
>
>> On 2023-08-29, David Brown <david.brown@hesbynett.no> wrote:
>>> On 29/08/2023 01:07, Tim Rentsch wrote:
>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>

>
>> Makefile has an M just to put it ahead of lower-cased filenames
>> in the lexicographic listing
>
>Can you provide a definitive reference for that assertion?
>I note that the 1978 Bell Labs version of make(1) read it's
>dependency list from a file called "makefile"[1]. I do not
>know when that changed to "Makefile".

Not sure about the assertion, but Unixware 2.1 make has:

static char makefile[] = "makefile",
Makefile[] = "Makefile",
Makeflags[] = "MAKEFLAGS",
RELEASE[] = "RELEASE";

And Unix v8:
$ strings /work/reference/usl/unix/v8/bin/make | grep Makefile
Makefile
s.Makefile

And Unix v7 tries 'makefile' first, if not found, then tries 'Makefile'.

if( !descset )
#ifdef unix
if( rddescf("makefile") ) rddescf("Makefile");
#endif
#ifdef gcos
rddescf("makefile");
#endif

Re: C vs Haskell for XML parsing

<ucnogj$2povs$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 17:50:43 +0200
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <ucnogj$2povs$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com>
<87pm3bot1n.fsf@bsb.me.uk>
<7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com>
<ucdcaf$mj8h$1@dont-email.me>
<627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com>
<ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad>
<86il8ywyu5.fsf@linuxsc.com> <uck607$2563l$1@dont-email.me>
<20230829121430.516@kylheku.com> <uclinu$2cs9n$1@dont-email.me>
<62855ccd-0d2c-431f-b776-f8f84eb58a4an@googlegroups.com>
<ucn5ni$2mv5b$1@dont-email.me>
<fb65da9e-a175-4e9d-8749-b5d45e5ceeb3n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 30 Aug 2023 15:50:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="33c983b9b450a8eca688d6546ca1e864";
logging-data="2941948"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+14U8RvTiaOqA0rfjYIlunRHKety7GcJc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:fsOn/I6QiPZVQo7SrMUfpG4b68I=
In-Reply-To: <fb65da9e-a175-4e9d-8749-b5d45e5ceeb3n@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Wed, 30 Aug 2023 15:50 UTC

On 30/08/2023 14:04, Malcolm McLean wrote:
> On Wednesday, 30 August 2023 at 11:30:26 UTC+1, David Brown wrote:
>> On 30/08/2023 09:43, Malcolm McLean wrote:
>>> On Tuesday, 29 August 2023 at 21:00:14 UTC+1, David Brown wrote:
>>>> On 29/08/2023 21:22, Kaz Kylheku wrote:
>>>>> On 2023-08-29, David Brown <david...@hesbynett.no> wrote:
>>>>>> On 29/08/2023 01:07, Tim Rentsch wrote:
>>>>>>> sc...@slp53.sl.home (Scott Lurndal) writes:
>>>>>>>
>>>>>>>> I will use [underscore] in preference to CamelCase, which I dislike
>>>>>>>> primarily because of the impact on my typing speed.
>>>>>>>
>>>>>>> In most cases I find CamelCase harder to read than using
>>>>>>> underscores, especially when using mono-spaced fonts.
>>>>>>
>>>>>> I used to use camelCase for most of my identifiers - now I find I am
>>>>>> using underscores much more, precisely because I find it easier to read.
>>>>>> I strongly suspect it is age-related - camelCase was more appealing
>>>>>> when my eyes were younger.
>>>>>
>>>>> CamelCase is at odds with the C language. It is not used in the standard
>>>>> library, and it's not used in the related POSIX standard which comes
>>>>> from the same birthplace.
>>>>>
>>>> Nonsense. Just because it is not used in the C standard library or
>>>> POSIX does not make it "at odds with the C language". It might be more
>>>> common in other languages than C, but it's fine for identifiers in C.
>>>>
>>> It's not in itself a knockdown, conclusive argument.
>>> But it's a good argument. Match the standard library house style.
>> It is not even remotely close to being a good argument.
>>
>> Consistency of style within a project, library, team, etc., is important
>> and makes the code easier to write, easier to read, and easier to use.
>> That's why projects or teams often have style guides.
>>
>> But there are no advantages in following a style from a different
>> project. If you are contributing to the C standards, or an extended
>> version of the C standard library, then follow the style for the C
>> standard library - no word separators for short function names,
>> underscores for long function names and macros, _t for types, etc. Most
>> people, however, are /not/ writing code for the C standard library, and
>> thus the style of the C standard library should not influence style for
>> their own code.
>>
> You call the standard library in most C projects.

You do not /write/ the standard library for most C projects.

> So the argument is that you should match the standard library style.

The argument is worthless.

> The alternative argument is that you should deliberately not match
> the standard library style, to make it obvious which calls are standard
> library calls and which are not.
>

That is equally worthless as an argument.

Re: C vs Haskell for XML parsing

<ucnqv5$2q4fv$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 12:32:37 -0400
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <ucnqv5$2q4fv$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<878r9zeynn.fsf@nosuchdomain.example.com> <AUaGM.174236$JG_b.91752@fx39.iad>
<ucbjph$96fa$1@dont-email.me> <ipdGM.457101$xMqa.238959@fx12.iad>
<uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad>
<ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com>
<ucdp4i$ot46$1@dont-email.me> <20230826210521.20@kylheku.com>
<ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com>
<87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com>
<87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com>
<ucjei2$1tv7s$1@dont-email.me> <20230828182115.305@kylheku.com>
<uckeel$26q6m$1@dont-email.me> <uckumo$29oe0$1@dont-email.me>
<875y4xboly.fsf@nosuchdomain.example.com> <ucn6hi$2n2kb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 30 Aug 2023 16:32:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c167313af5a3001729b5714881da1678";
logging-data="2953727"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nh1Z9+XEa4YLf/mMl5oMwkQFQr8i4SK4="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:Q/EF+JIxRWmv/AMNg5kCBMPcoKs=
In-Reply-To: <ucn6hi$2n2kb$1@dont-email.me>
Content-Language: en-US
 by: James Kuyper - Wed, 30 Aug 2023 16:32 UTC

On 8/30/23 06:44, David Brown wrote:
....
> Until it was mentioned in this thread, I didn't realise that dollars (or
> other characters) in identifiers were implementation-defined options,
> rather than requiring it to be an extension. (The distinction I would
> make here is that an "extension" is for something that the standard does
> not cover at all but is documented by the compiler - something that
> would be a syntax error, a constraint violation, or undefined behaviour
> if the compiler did not support it.)

The defining characteristic of a C extension is "A conforming
implementation may have extensions (including additional library
functions), provided they do not alter the behavior of any strictly
conforming program." Since it is implementation-defined whether those
characters can be used, a strictly conforming program cannot use them,

I would have preferred that they call these "conforming" extensions -
that is, extensions that do not render the implementation
non-conforming. I think it would be appropriate to talk about extensions
that render an implementation non-conforming, calling them
"non-conforming extensions".

Re: C vs Haskell for XML parsing

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

  copy mid

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

  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....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 11:42:40 -0700
Organization: None to speak of
Lines: 77
Message-ID: <87o7io9xsv.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ucbjph$96fa$1@dont-email.me> <ipdGM.457101$xMqa.238959@fx12.iad>
<uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad>
<ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com>
<ucdp4i$ot46$1@dont-email.me> <20230826210521.20@kylheku.com>
<ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com>
<87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com>
<87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com>
<ucjei2$1tv7s$1@dont-email.me> <20230828182115.305@kylheku.com>
<uckeel$26q6m$1@dont-email.me> <uckumo$29oe0$1@dont-email.me>
<875y4xboly.fsf@nosuchdomain.example.com>
<ucn6hi$2n2kb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="c1c8ce4c37b1e802642b7baee24e084b";
logging-data="2996058"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rzmLVcBLNxt44vNrArTZj"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:pucSG4FPDFXin13wHk7DZEJg8G0=
sha1:yvC22pZpsazuFqfxNJkGR4Je9Us=
 by: Keith Thompson - Wed, 30 Aug 2023 18:42 UTC

David Brown <david.brown@hesbynett.no> writes:
> On 29/08/2023 22:06, Keith Thompson wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>> [...]
>>> Being able to accept $ in identifiers is a convenient extension.
>> Quibble: $ in identifiers is not an extension as specified in
>> section 4
>> of the standard. Starting in C99, the set of characters accepted in
>> identifiers is implementation-defined. (I'm not sure what difference
>> that makes.)
>
> Until it was mentioned in this thread, I didn't realise that dollars
> (or other characters) in identifiers were implementation-defined
> options, rather than requiring it to be an extension. (The
> distinction I would make here is that an "extension" is for something
> that the standard does not cover at all but is documented by the
> compiler - something that would be a syntax error, a constraint
> violation, or undefined behaviour if the compiler did not support it.)
> As you say, I don't think there is a significant difference in
> practice, but I like to understand these things as accurately as I
> can, and I appreciate the bug-fix when I get them wrong.
>
> On a related note, I am looking at 6.4.2.1p3 (in C11) on "universal
> character names", and it appears to say that the characters must come
> from the list in D.1 (but not D.2, for the initial character), but
> also that implementations can allow other characters. This would make
> the D.1 list the minimal set allowed, but implementations could allow
> any (or almost any) other Unicode characters. Do you think that is
> right, or am I missing something?

C23 reworks the definition of "identifier". See N3096 6.4.2.1.
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf

An identifier may start with any of:
nondigit
XID_Start character
universal-character-name of class XID_Start
followed by zero or more of:
digit
nondigit
XID_Continue character
universal-character-name of class XID_Continue
where "digit" is one of 0..9 and "nondigit" is underscore or one of the
52 uppercase and lowercase Latin letters.

XID_Start and XID_Continue are specified in "UAX #44"
https://unicode.org/reports/tr44/
I haven't yet read enough of it to figure out what those mean.
Annex D has more information.

Under Semantics, N3096 says:
An XID_Start character is an implementation-defined character whose
corresponding code point in ISO/IEC 10646 has the XID_Start
property. An XID_Continue character is an implementation-defined
character whose corresponding code point in ISO/IEC 10646 has the
XID_Continue property.

My understanding is that an implementation will choose and document some
subset of the XID_Start and XID_Continue characters to be valid in
identifiers.

One odd thing (in both N1570 and N3096) is that the Semantics subsection
uses "shall". For example, N1570 6.4.2.1p3 says:

Each universal character name in an identifier shall designate a
character whose encoding in ISO/IEC 10646 falls into one of the
ranges specified in D.1. The initial character shall not be a
universal character name designating a character whose encoding
falls into one of the ranges specified in D.2.

This implies that a violation of such a requirement has undefined
behavior. I would have expected it to be a syntax error.

--
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: C vs Haskell for XML parsing

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

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 11:44:59 -0700
Organization: None to speak of
Lines: 31
Message-ID: <87jztc9xp0.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com>
<87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com>
<87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com>
<ucjei2$1tv7s$1@dont-email.me> <20230828182115.305@kylheku.com>
<uckeel$26q6m$1@dont-email.me> <uckumo$29oe0$1@dont-email.me>
<875y4xboly.fsf@nosuchdomain.example.com>
<ucn6hi$2n2kb$1@dont-email.me> <ucnqv5$2q4fv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="c1c8ce4c37b1e802642b7baee24e084b";
logging-data="2996058"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+t/C6avjQCzQX3bmNyio48"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:LRgYpQR4OMPKeJ6zeLbgb77N95A=
sha1:pQw5uEnkKBcpQBGH6fpoJQft7Pk=
 by: Keith Thompson - Wed, 30 Aug 2023 18:44 UTC

James Kuyper <jameskuyper@alumni.caltech.edu> writes:
> On 8/30/23 06:44, David Brown wrote:
> ...
>> Until it was mentioned in this thread, I didn't realise that dollars (or
>> other characters) in identifiers were implementation-defined options,
>> rather than requiring it to be an extension. (The distinction I would
>> make here is that an "extension" is for something that the standard does
>> not cover at all but is documented by the compiler - something that
>> would be a syntax error, a constraint violation, or undefined behaviour
>> if the compiler did not support it.)
>
> The defining characteristic of a C extension is "A conforming
> implementation may have extensions (including additional library
> functions), provided they do not alter the behavior of any strictly
> conforming program." Since it is implementation-defined whether those
> characters can be used, a strictly conforming program cannot use them,
>
> I would have preferred that they call these "conforming" extensions -
> that is, extensions that do not render the implementation
> non-conforming. I think it would be appropriate to talk about extensions
> that render an implementation non-conforming, calling them
> "non-conforming extensions".

That might be useful, but I suggest that anything that renders an
implementation non-conforming is simply outside the scope of the
standard.

--
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: C vs Haskell for XML parsing

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

  copy mid

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

  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....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 12:00:45 -0700
Organization: None to speak of
Lines: 29
Message-ID: <87fs409wyq.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com>
<87pm3bot1n.fsf@bsb.me.uk>
<7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com>
<ucdcaf$mj8h$1@dont-email.me>
<627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com>
<ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad>
<86il8ywyu5.fsf@linuxsc.com> <uck607$2563l$1@dont-email.me>
<20230829121430.516@kylheku.com> <ucnkde$2op2r$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="c1c8ce4c37b1e802642b7baee24e084b";
logging-data="2996058"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194uSdlDHoDHZxSVEXIp1OT"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:BUxZvIftrXsgCflNcC/ap1QViR8=
sha1:cdEX6Dqlgij6pcqeL33cAY3OkZQ=
 by: Keith Thompson - Wed, 30 Aug 2023 19:00 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
> On Tue, 29 Aug 2023 19:22:09 +0000, Kaz Kylheku wrote:
[...]
>> Makefile has an M just to put it ahead of lower-cased filenames
>> in the lexicographic listing
>
> Can you provide a definitive reference for that assertion?
> I note that the 1978 Bell Labs version of make(1) read it's
> dependency list from a file called "makefile"[1]. I do not
> know when that changed to "Makefile".

I wouldn't necessarily call this definitive, but the manual for GNU make
says:

Normally you should call your makefile either `makefile' or
`Makefile'. (We recommend `Makefile' because it appears prominently
near the beginning of a directory listing, right near other important
files such as `README'.) The first name checked, `GNUmakefile', is not
recommended for most makefiles. You should use this name if you have a
makefile that is specific to GNU `make', and will not be understood by
other versions of `make'. Other `make' programs look for `makefile' and
`Makefile', but not `GNUmakefile'.

That's from GNU make 3.75, released in 1996.

--
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: Named function arguments (Was : C vs Haskell for XML parsing)

<9OdIB8bvkgNvRPt7n@bongo-ra.co>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Re: Named function arguments (Was : C vs Haskell for XML parsing)
Date: Wed, 30 Aug 2023 19:30:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <9OdIB8bvkgNvRPt7n@bongo-ra.co>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <uca3sh$p9c$1@dont-email.me>
<878r9zeynn.fsf@nosuchdomain.example.com> <AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad>
<ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com>
<87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 30 Aug 2023 19:30:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e438d4628798917ec500c3b6bf2a5f9a";
logging-data="3011574"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JH7r4NrQmRdb81FZ3oKVf"
Cancel-Lock: sha1:9HxbcU8Hd4dl1jPR+B7rGpMaPuk=
In-Reply-To: <861qfmwwvy.fsf@linuxsc.com>
X-Server-Commands: nowebcancel
X-Organisation: Weyland-Yutani
 by: Spiros Bousbouras - Wed, 30 Aug 2023 19:30 UTC

On Mon, 28 Aug 2023 16:49:21 -0700
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
> > Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> >> I favor a different approach to this problem:
> >>
> >> static inline char *
> >> copy_to_from( char *to, const char *from ){
> >> return strcpy( to, from );
> >> }
> >>
> >> with no language changes needed. And people are still free to
> >> use the more concise form if they so desire.
> >
> > But if we change the names used in the standard for strcpy's parameters,
>
> Part of the point of my approach is that it doesn't need any
> changes to the C standard.
>
> > there's no need for a wrapper function (with, in your approach, a name
> > that doesn't suggest that it operates on strings).
>
> That's incidental. It could be copy_string_to_from();
>
> > Your wrapper would be useful only if the language added named arguments,
> > yes?
>
> Not at all, that's the point. The function name indicates where
> the destination (to) and source (from) arguments go. There is
> no reason a declaration has to use those names, or any names at
> all, for the function parameters. All the information needed
> is present in the name of the function.

If one is willing to write a wrapper function then why not do it like this :

struct struct_strcpy {
char * to ;
const char * from ;
}

and have the wrapper function take as a single argument a pointer to struct
struct_strcpy .This way no changes to the language are needed , everyone can
choose whatever member names they prefer , they can reuse the same structure
object if some members have the same value for different function calls (and
assign to the other members) and they can define a structure with default
values if they so wish.

Does having named arguments offer anything over this approach ?

> > I'd expect that an edition of the standard that added named
> > arguments would also rework the argument names in the standard library.
>
> Part of the advantage of the approach I favor is it doesn't
> need to wait for a new edition of the C standard. I think
> there are lots of cases where simply adopting a coding style
> obviates any need for new language features.

--
Every theatre is an insane asylum, but an opera theatre is the
ward for the incurables.
Franz Schalk

Re: C vs Haskell for XML parsing

<20230830122002.133@kylheku.com>

  copy mid

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

  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-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 19:41:04 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <20230830122002.133@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com>
<87pm3bot1n.fsf@bsb.me.uk>
<7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com>
<ucdcaf$mj8h$1@dont-email.me>
<627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com>
<ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad>
<86il8ywyu5.fsf@linuxsc.com> <uck607$2563l$1@dont-email.me>
<20230829121430.516@kylheku.com> <uclinu$2cs9n$1@dont-email.me>
<62855ccd-0d2c-431f-b776-f8f84eb58a4an@googlegroups.com>
<ucn5ni$2mv5b$1@dont-email.me>
<fb65da9e-a175-4e9d-8749-b5d45e5ceeb3n@googlegroups.com>
<ucnogj$2povs$1@dont-email.me>
Injection-Date: Wed, 30 Aug 2023 19:41:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b657d1e36c82df8a461d523776bf923";
logging-data="3014672"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+erhQYsNkPRKP37Vgjk+RzTa1OOFL5m1k="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:MVr1ms1XE22IoH+lfuOZHmNUAjM=
 by: Kaz Kylheku - Wed, 30 Aug 2023 19:41 UTC

On 2023-08-30, David Brown <david.brown@hesbynett.no> wrote:
> On 30/08/2023 14:04, Malcolm McLean wrote:
>> You call the standard library in most C projects.
>
> You do not /write/ the standard library for most C projects.
>
>> So the argument is that you should match the standard library style.
>
> The argument is worthless.
>
>> The alternative argument is that you should deliberately not match
>> the standard library style, to make it obvious which calls are standard
>> library calls and which are not.
>
> That is equally worthless as an argument.

Coding conventions are arbitrarily chosen, an enforced not by arguments
but authority: ranging from "your patch is rejected" to "write like this
or find work somewhere else".

But there exists a consistency argument: if you don't conform to the
coding convention, then code becomes harder to work with. (As real
experience with mixed style codebases informs us.)

If the naming recommended by the coding convention is at odds with the
language, then that prevents maximal consistency from being reached.

If consistency is good, globally maximal consistency is better than
locally maximal consistency.

Thus there is exists a consistency argument against choosing
a CamelCase naming convention in a brand new C project with zero
legacy code.

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

Re: Named function arguments (Was : C vs Haskell for XML parsing)

<20230830124510.831@kylheku.com>

  copy mid

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

  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-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Named function arguments (Was : C vs Haskell for XML parsing)
Date: Wed, 30 Aug 2023 19:53:02 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <20230830124510.831@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <9OdIB8bvkgNvRPt7n@bongo-ra.co>
Injection-Date: Wed, 30 Aug 2023 19:53:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b657d1e36c82df8a461d523776bf923";
logging-data="3014672"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sPtLTWyPbPBumfz8axLNMWuZhHVdipcA="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:B8piRDVtmJHUUBMmUpb0Muh4nOA=
 by: Kaz Kylheku - Wed, 30 Aug 2023 19:53 UTC

On 2023-08-30, Spiros Bousbouras <spibou@gmail.com> wrote:
> If one is willing to write a wrapper function then why not do it like this :
>
> struct struct_strcpy {
> char * to ;
> const char * from ;
> }
>
> and have the wrapper function take as a single argument a pointer to struct
> struct_strcpy .This way no changes to the language are needed , everyone can
> choose whatever member names they prefer

Not according to the rule that struct types in different translation
units must havre the same member names if they are to be considered
compatible.

> they can reuse the same structure
> object if some members have the same value for different function calls (and
> assign to the other members) and they can define a structure with default
> values if they so wish.
>
> Does having named arguments offer anything over this approach ?

Pragmatics:

- Poor ergonomics of calling functions that take struct-encapsulated
tuple arguments instead of individual arguments.

- E.g. clumsy for a function to call another function that *almost* takes
the same arguments. The incoming struct must be destructured,
and the member values used to initialize the new structure.

- Reduced diagnosis: all arguments have become optional, because
designated initializers are optional! If we add a new parameter by
adding a member to the struct, the compiler will not find the places
that need a new argument.

- ABI concerns: binary compatibility now dominated by rules for
structure passing.

- Poor performance in ABIs that don't use registers for struct passing,
even for small structs.

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

Re: Named function arguments (Was : C vs Haskell for XML parsing)

<=cpNTIYn=xLPR00Wq@bongo-ra.co>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Re: Named function arguments (Was : C vs Haskell for XML parsing)
Date: Wed, 30 Aug 2023 20:07:24 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <=cpNTIYn=xLPR00Wq@bongo-ra.co>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <uca3sh$p9c$1@dont-email.me>
<878r9zeynn.fsf@nosuchdomain.example.com> <AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad>
<ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com>
<87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <9OdIB8bvkgNvRPt7n@bongo-ra.co> <20230830124510.831@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 30 Aug 2023 20:07:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e438d4628798917ec500c3b6bf2a5f9a";
logging-data="3022530"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rjCOE9hj35fdrtaqdJvx1"
Cancel-Lock: sha1:FtSeeEjPg9dxsVmEK6exTAUrZK0=
X-Organisation: Weyland-Yutani
In-Reply-To: <20230830124510.831@kylheku.com>
X-Server-Commands: nowebcancel
 by: Spiros Bousbouras - Wed, 30 Aug 2023 20:07 UTC

On Wed, 30 Aug 2023 19:53:02 -0000 (UTC)
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> On 2023-08-30, Spiros Bousbouras <spibou@gmail.com> wrote:
> > If one is willing to write a wrapper function then why not do it like this :
> >
> > struct struct_strcpy {
> > char * to ;
> > const char * from ;
> > }
> >
> > and have the wrapper function take as a single argument a pointer to struct
> > struct_strcpy .This way no changes to the language are needed , everyone can
> > choose whatever member names they prefer
>
> Not according to the rule that struct types in different translation
> units must havre the same member names if they are to be considered
> compatible.

Why would anyone choose different member names in different translation
units ? They just declare the structure once in some header.

> > they can reuse the same structure
> > object if some members have the same value for different function calls (and
> > assign to the other members) and they can define a structure with default
> > values if they so wish.
> >
> > Does having named arguments offer anything over this approach ?
>
> Pragmatics:
>
> - Poor ergonomics of calling functions that take struct-encapsulated
> tuple arguments instead of individual arguments.
>
> - E.g. clumsy for a function to call another function that *almost* takes
> the same arguments. The incoming struct must be destructured,
> and the member values used to initialize the new structure.

I don't see how this becomes simpler with named arguments.

> - Reduced diagnosis: all arguments have become optional, because
> designated initializers are optional! If we add a new parameter by
> adding a member to the struct, the compiler will not find the places
> that need a new argument.

Yes this may be an issue. But compilers could warn about it.

> - ABI concerns: binary compatibility now dominated by rules for
> structure passing.
>
> - Poor performance in ABIs that don't use registers for struct passing,
> even for small structs.

I said
the wrapper function take as a single argument a pointer to struct

--
vlaho.ninja/prog

Re: Named function arguments (Was : C vs Haskell for XML parsing)

<20230830130958.888@kylheku.com>

  copy mid

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

  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-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Named function arguments (Was : C vs Haskell for XML parsing)
Date: Wed, 30 Aug 2023 20:42:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 113
Message-ID: <20230830130958.888@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <9OdIB8bvkgNvRPt7n@bongo-ra.co>
<20230830124510.831@kylheku.com> <=cpNTIYn=xLPR00Wq@bongo-ra.co>
Injection-Date: Wed, 30 Aug 2023 20:42:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b657d1e36c82df8a461d523776bf923";
logging-data="3033089"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+aBuu1W5/RuBO0cxri0Zm95Lh6PnR6P8w="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:woYBGczSO+R56sioeWFOIge4hIg=
 by: Kaz Kylheku - Wed, 30 Aug 2023 20:42 UTC

On 2023-08-30, Spiros Bousbouras <spibou@gmail.com> wrote:
> On Wed, 30 Aug 2023 19:53:02 -0000 (UTC)
> Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>> On 2023-08-30, Spiros Bousbouras <spibou@gmail.com> wrote:
>> > If one is willing to write a wrapper function then why not do it like this :
>> >
>> > struct struct_strcpy {
>> > char * to ;
>> > const char * from ;
>> > }
>> >
>> > and have the wrapper function take as a single argument a pointer to struct
>> > struct_strcpy .This way no changes to the language are needed , everyone can
>> > choose whatever member names they prefer
>>
>> Not according to the rule that struct types in different translation
>> units must havre the same member names if they are to be considered
>> compatible.
>
> Why would anyone choose different member names in different translation
> units ? They just declare the structure once in some header.

OK, I wrongly interpreted "everyone can choose whatever member names
they prefer" means. Not everyone working in the same project,
calling the same function.
>
>> > they can reuse the same structure
>> > object if some members have the same value for different function calls (and
>> > assign to the other members) and they can define a structure with default
>> > values if they so wish.
>> >
>> > Does having named arguments offer anything over this approach ?
>>
>> Pragmatics:
>>
>> - Poor ergonomics of calling functions that take struct-encapsulated
>> tuple arguments instead of individual arguments.
>>
>> - E.g. clumsy for a function to call another function that *almost* takes
>> the same arguments. The incoming struct must be destructured,
>> and the member values used to initialize the new structure.
>
> I don't see how this becomes simpler with named arguments.

void foo(int a, int b, int c)
{
bar(a: c, b: b:, c: a, d: SOME_CONSTANT);
}

vs something like:

void foo(foo_struct args)
{
bar((bar_struct) {a: args.c, b: args.b:, c: args.a, d: SOME_CONSTANT});
}

You're missing syntactic sugar to make it smooth. What I want here
is a translator for a C-with-named-args to C-without-name-args
which generates the latter code from the former.

Another issue is that if a structure takes names args by way
of a structure, then that is not optional, unlike the proposals
for names args which make them optional.

The former foo() could dispense with named args and just call
bar like this:

bar(a, b, c, SOME_CONSTANT);

(If bar is an internal helper in the same module, with the argument
conventions being consistent, why would you bother with named args.)

>> - Reduced diagnosis: all arguments have become optional, because
>> designated initializers are optional! If we add a new parameter by
>> adding a member to the struct, the compiler will not find the places
>> that need a new argument.
>
> Yes this may be an issue. But compilers could warn about it.

Or other solutions, like a declaration mechanism in a struct/enum
which stipulates that certain members must be explicitly initialized
(and so become de facto required arguments when structs are used
as parameter tuples).
>
>> - ABI concerns: binary compatibility now dominated by rules for
>> structure passing.
>>
>> - Poor performance in ABIs that don't use registers for struct passing,
>> even for small structs.
>
> I said
> the wrapper function take as a single argument a pointer to struct

Probably, this is something that projects would decide on a case
by case basis.

Dealing with structs passed by pointer at the ABI level is much more
consistent; you're only dealing with the layout rules. E.g. targetting
a function with a struct pointer argument versus struct argument
via FFI can be easier (in particular if there is no ownership protocol:
caller continues to own).

There is the extra pointer indirection though. We lose the ability
to pass small numbers of scalar parameters via registers.

We don't (necessarily) lose that that with a struct by-value.
It's entirely possible that a struct { int a, b, c, d; } is passed via
four registers.

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

Re: Named function arguments (Was : C vs Haskell for XML parsing)

<ucof1i$2tbqe$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: richard....@gmail.com (Richard Harnden)
Newsgroups: comp.lang.c
Subject: Re: Named function arguments (Was : C vs Haskell for XML parsing)
Date: Wed, 30 Aug 2023 23:15:13 +0100
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <ucof1i$2tbqe$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <9OdIB8bvkgNvRPt7n@bongo-ra.co>
<20230830124510.831@kylheku.com> <=cpNTIYn=xLPR00Wq@bongo-ra.co>
Reply-To: nospam.harnden@gmail.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 30 Aug 2023 22:15:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1ebdc50e73cbc89cbcd4367155ec342c";
logging-data="3059534"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/v99IoA/3EUcwqiNLs2CLLSe2q0lvZQxQ="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.15.0
Cancel-Lock: sha1:u1tjk/FJvuzCk5S1bc53JXqs+4I=
In-Reply-To: <=cpNTIYn=xLPR00Wq@bongo-ra.co>
 by: Richard Harnden - Wed, 30 Aug 2023 22:15 UTC

On 30/08/2023 21:07, Spiros Bousbouras wrote:

>
> I said
> the wrapper function take as a single argument a pointer to struct
>

Can a struct have the same qualifiers as a function?

I mean, say you have:
void foo(const char * restrict bar);

Can you have ...?

struct foo
{ const char * restrict bar;
};

void foos(struct foo foo);

.... ?

Does the const/restrict'ness survive?

Re: Named function arguments (Was : C vs Haskell for XML parsing)

<86r0njubf1.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Named function arguments (Was : C vs Haskell for XML parsing)
Date: Wed, 30 Aug 2023 20:40:34 -0700
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <86r0njubf1.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com> <AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me> <ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me> <20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com> <9OdIB8bvkgNvRPt7n@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="49a0c7fba7d7c0f06cea865d80b29294";
logging-data="3268288"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18khZO3/JXy4h0Dr/TQReOBf26yCCd44u8="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:oJqkIlINVqzM87eBaRjKNMykzGU=
sha1:IY6k+FCJOsEO1AZ3h4XMohk/2mA=
 by: Tim Rentsch - Thu, 31 Aug 2023 03:40 UTC

Spiros Bousbouras <spibou@gmail.com> writes:

> On Mon, 28 Aug 2023 16:49:21 -0700
> Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>
>>>> I favor a different approach to this problem:
>>>>
>>>> static inline char *
>>>> copy_to_from( char *to, const char *from ){
>>>> return strcpy( to, from );
>>>> }
>>>>
>>>> with no language changes needed. And people are still free to
>>>> use the more concise form if they so desire.
>>>
>>> But if we change the names used in the standard for strcpy's parameters,
>>
>> Part of the point of my approach is that it doesn't need any
>> changes to the C standard.
>>
>>> there's no need for a wrapper function (with, in your approach, a name
>>> that doesn't suggest that it operates on strings).
>>
>> That's incidental. It could be copy_string_to_from();
>>
>>> Your wrapper would be useful only if the language added named arguments,
>>> yes?
>>
>> Not at all, that's the point. The function name indicates where
>> the destination (to) and source (from) arguments go. There is
>> no reason a declaration has to use those names, or any names at
>> all, for the function parameters. All the information needed
>> is present in the name of the function.
>
> If one is willing to write a wrapper function then why not do it
> like this :
>
> struct struct_strcpy {
> char * to ;
> const char * from ;
> }
>
> and have the wrapper function take as a single argument a pointer
> to struct struct_strcpy . [...]

Because it's needlessly clunky, and adds annoying visual clutter
at every call site.

Re: C vs Haskell for XML parsing

<86msy7uayk.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 20:50:27 -0700
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <86msy7uayk.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com> <uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <j=2ifExxFfXU05g0F@bongo-ra.co> <ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com> <87pm3bot1n.fsf@bsb.me.uk> <7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com> <ucdcaf$mj8h$1@dont-email.me> <627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com> <ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad> <86il8ywyu5.fsf@linuxsc.com> <uck607$2563l$1@dont-email.me> <20230829121430.516@kylheku.com> <ucnkde$2op2r$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="49a0c7fba7d7c0f06cea865d80b29294";
logging-data="3268288"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2zxoa9j1Yk43kPoR0sf1aRNJUeAE75lQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:kLQDMFwR2WehNlpRmiFuNOo8PW0=
sha1:wqfmw+6ahP9+3zJ4lx+O/z6IG4I=
 by: Tim Rentsch - Thu, 31 Aug 2023 03:50 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:

> On Tue, 29 Aug 2023 19:22:09 +0000, Kaz Kylheku wrote:
>
>> On 2023-08-29, David Brown <david.brown@hesbynett.no> wrote:
>>
>>> On 29/08/2023 01:07, Tim Rentsch wrote:
>>>
>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>
>>>>> I will use [underscore] in preference to CamelCase, which I
>>>>> dislike primarily because of the impact on my typing speed.
>>>>
>>>> In most cases I find CamelCase harder to read than using
>>>> underscores, especially when using mono-spaced fonts.
>>>
>>> I used to use camelCase for most of my identifiers - now I find I
>>> am using underscores much more, precisely because I find it easier
>>> to read. I strongly suspect it is age-related - camelCase was
>>> more appealing when my eyes were younger.
>>
>> CamelCase is at odds with the C language.
>
> I would disagree. CamelCase (as in identifiers consisting of a mix of
> upper and lower case characters) is inherent in the definition of an
> identifier, and has been since K&R C. [...]

CamelCase is consistent with C syntax; it feels out of place
though in terms of common usage. ISTM that CamelCase was never
used in C until C++ started using it, which I think started
happening because Smalltalk uses camelCase (and CamelCase), and
C++ has Smalltalk envy.

Feel free to take the above either as just statements of
personal opinion or as unsubstantiated beliefs.

Re: C vs Haskell for XML parsing

<86il8vua3h.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 21:09:06 -0700
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <86il8vua3h.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me> <20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com> <ucjei2$1tv7s$1@dont-email.me> <20230828182115.305@kylheku.com> <uckeel$26q6m$1@dont-email.me> <uckumo$29oe0$1@dont-email.me> <875y4xboly.fsf@nosuchdomain.example.com> <864jkhun64.fsf@linuxsc.com> <87sf819bi3.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="49a0c7fba7d7c0f06cea865d80b29294";
logging-data="3276242"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ooRxmBfAgw4hDp/WceK/+lCV6rH/MkqM="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:dsH8NfM5feyYqIFSvyYkr+TP4nA=
sha1:x5W6ilXLhVU33wUG7V8N42iKHMk=
 by: Tim Rentsch - Thu, 31 Aug 2023 04:09 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> David Brown <david.brown@hesbynett.no> writes:
>>> [...]
>>>
>>>> Being able to accept $ in identifiers is a convenient extension.
>>>
>>> Quibble: $ in identifiers is not an extension as specified in section 4
>>> of the standard. Starting in C99, the set of characters accepted in
>>> identifiers is implementation-defined. (I'm not sure what difference
>>> that makes.)
>>
>> In Annex J, J.5.2 gives adding $ to the set of characters that
>> can appear in identifiers as an example of a common extension.
>
> C90 says the same thing in its Annex G. Looks like they didn't update
> it when C99 updated the syntax for an identifier.

Certainly it's true that this passage wasn't changed. That doesn't
mean it wasn't reviewed; it may have been deliberately left in.
There have been lots of opportunities to change it, and it hasn't
been changed yet.

> (Though I suppose an
> implementation could accept $ in identifiers either as an extension or
> as an "other implementation-defined character".)

Yes, no question about it. Furthermore implementors might make one
choice or the other, depending on how they think of the character(s)
in question. For myself, I expect I would naturally think of adding
characters from another alphabet in the implementation-defined
sense, but think of adding $ in the extension sense. Having both
options has some value, in terms of conveying mindset.

Re: C vs Haskell for XML parsing

<86a5u7u39b.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Wed, 30 Aug 2023 23:36:48 -0700
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <86a5u7u39b.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me> <20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com> <ucjei2$1tv7s$1@dont-email.me> <20230828182115.305@kylheku.com> <uckeel$26q6m$1@dont-email.me> <uckumo$29oe0$1@dont-email.me> <875y4xboly.fsf@nosuchdomain.example.com> <ucn6hi$2n2kb$1@dont-email.me> <87o7io9xsv.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="49a0c7fba7d7c0f06cea865d80b29294";
logging-data="3311199"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6yAWsRoJ5k4i68CLsR14+0UMgxZrzz4s="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:wMzkdbio37vOnphN8Fl9EYhRiNU=
sha1:oO1iax3n9vB1tkTNQ1ptyh+OaiA=
 by: Tim Rentsch - Thu, 31 Aug 2023 06:36 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

[..syntax for identifiers...]

> One odd thing (in both N1570 and N3096) is that the Semantics
> subsection uses "shall". For example, N1570 6.4.2.1p3 says:
>
> Each universal character name in an identifier shall designate
> a character whose encoding in ISO/IEC 10646 falls into one of
> the ranges specified in D.1. The initial character shall not
> be a universal character name designating a character whose
> encoding falls into one of the ranges specified in D.2.
>
> This implies that a violation of such a requirement has undefined
> behavior. I would have expected it to be a syntax error.

Clearly the idea is that implementations be allowed to choose
what other universal character names, if any, are to be permitted
in identifiers. As an example, consider an implementation that
supports the common extension of allowing dollar signs in
identifiers. It would make sense, in case a keyboard is being
used that doesn't have a dollar sign key, to allow the universal
character name for dollar sign (\u0024, IIANM). Other universal
character names might serve some other purpose, not being part
of the identifier but not necessarily causing an error either.
Apparently anything less than undefined behavior was thought to
be too limiting.

Re: C vs Haskell for XML parsing

<20230831004230.649@kylheku.com>

  copy mid

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

  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-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Thu, 31 Aug 2023 08:12:52 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <20230831004230.649@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com>
<87pm3bot1n.fsf@bsb.me.uk>
<7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com>
<ucdcaf$mj8h$1@dont-email.me>
<627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com>
<ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad>
<86il8ywyu5.fsf@linuxsc.com> <uck607$2563l$1@dont-email.me>
<20230829121430.516@kylheku.com> <ucnkde$2op2r$1@dont-email.me>
<86msy7uayk.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 31 Aug 2023 08:12:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70d02f2c57901333f8c8fdfdb470c4f7";
logging-data="3334885"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dNgGk47rYCPCDeX+3MaUizsGuthcK7Hw="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:jw8cFuiF9R2tVwjUY38k6qvndMQ=
 by: Kaz Kylheku - Thu, 31 Aug 2023 08:12 UTC

On 2023-08-31, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>
>> On Tue, 29 Aug 2023 19:22:09 +0000, Kaz Kylheku wrote:
>>
>>> On 2023-08-29, David Brown <david.brown@hesbynett.no> wrote:
>>>
>>>> On 29/08/2023 01:07, Tim Rentsch wrote:
>>>>
>>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>>
>>>>>> I will use [underscore] in preference to CamelCase, which I
>>>>>> dislike primarily because of the impact on my typing speed.
>>>>>
>>>>> In most cases I find CamelCase harder to read than using
>>>>> underscores, especially when using mono-spaced fonts.
>>>>
>>>> I used to use camelCase for most of my identifiers - now I find I
>>>> am using underscores much more, precisely because I find it easier
>>>> to read. I strongly suspect it is age-related - camelCase was
>>>> more appealing when my eyes were younger.
>>>
>>> CamelCase is at odds with the C language.
>>
>> I would disagree. CamelCase (as in identifiers consisting of a mix of
>> upper and lower case characters) is inherent in the definition of an
>> identifier, and has been since K&R C. [...]
>
> CamelCase is consistent with C syntax; it feels out of place
> though in terms of common usage.

It isn't "euphonic".

"White and black" is also valid English syntax; we prefer to hear "black
and white".

When we hear "white and black", we wonder, is it a proper name?
"White and Black, Barristers and Solicitors" or something?

> ISTM that CamelCase was never
> used in C until C++ started using it, which I think started
> happening because Smalltalk uses camelCase (and CamelCase), and
> C++ has Smalltalk envy.

Even if the Smalltalk connection is true, the influence is
probably by way of the Pascal family languages. These use
CamelCase. For instance see the "Turbo PascalĀ® - Reference Guide"
on bitsavers.org.

Was the Pascal world afflicted with SmallTalk envy? It's hard
to say. But Niklaus Wirth's Pascal report from 1970 already shows
hints of the nucleation of CamelCase; it contains instances
of capitalized identifiers like Boolean, Power, and whatnot.

CamelCase was used in implementing Microsoft Windows, and also
MIT XWindow, and in Apple operating systems. Apple notably used
Pascal in the 1980s an important systems language.

Microsoft's AFX, later renamed MFC, uses CamelCase. This helps
it blend in with Win32.

ISO C++ doesn't use CamelCase; it has snake case like
std::basic_string<>, and static_cast.

I don't recall seeing CamelCase in Stroustrup's books like
the _C++ Annotated Reference Manual_ (ARM "brown book" co-authored
with Margaret Ellis or his other books).

I'm looking (in Google Books) inside _C++ Primer_ by Stanley Lippman, Barbara
Moo, et al, fifth ed with C++11. All I see is snake_case, though
I managed to spy an instance of Camel_snake.

In Andrew Koenig's _Accelerated C++_ I see things like Vec,
Number and Student_info. But not Student_Info or StudentInfo.

Aha! C++ influencer Scott Meyers appears to be a culprit in spreading
the practice. Looking into _Effective C++_, I see that it is teeming
with Dromedaries and BacTrians.

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

Re: C vs Haskell for XML parsing

<20230831011341.24@kylheku.com>

  copy mid

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

  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-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Thu, 31 Aug 2023 08:15:56 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <20230831011341.24@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <ucjei2$1tv7s$1@dont-email.me>
<20230828182115.305@kylheku.com> <uckeel$26q6m$1@dont-email.me>
<uckumo$29oe0$1@dont-email.me> <875y4xboly.fsf@nosuchdomain.example.com>
<ucn6hi$2n2kb$1@dont-email.me> <87o7io9xsv.fsf@nosuchdomain.example.com>
<86a5u7u39b.fsf@linuxsc.com>
Injection-Date: Thu, 31 Aug 2023 08:15:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70d02f2c57901333f8c8fdfdb470c4f7";
logging-data="3334885"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19v3xJvHF2ot9GdiCcEfmuARSj2uNnjzDE="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:iopfhnnWhBy9DUxcnYyXORxPgec=
 by: Kaz Kylheku - Thu, 31 Aug 2023 08:15 UTC

On 2023-08-31, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> in identifiers. As an example, consider an implementation that
> supports the common extension of allowing dollar signs in
> identifiers. It would make sense, in case a keyboard is being
> used that doesn't have a dollar sign key, to allow the universal
> character name for dollar sign (\u0024, IIANM). Other universal

Maybe let that coder expense $15 on the company credit card to get a
better keyboard instad of inflicting \u0024 on future maintainers of the
code.

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

Re: C vs Haskell for XML parsing

<ucplsh$36a8s$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Thu, 31 Aug 2023 11:18:08 +0200
Organization: A noiseless patient Spider
Lines: 86
Message-ID: <ucplsh$36a8s$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com>
<87pm3bot1n.fsf@bsb.me.uk>
<7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com>
<ucdcaf$mj8h$1@dont-email.me>
<627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com>
<ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad>
<86il8ywyu5.fsf@linuxsc.com> <uck607$2563l$1@dont-email.me>
<20230829121430.516@kylheku.com> <uclinu$2cs9n$1@dont-email.me>
<62855ccd-0d2c-431f-b776-f8f84eb58a4an@googlegroups.com>
<ucn5ni$2mv5b$1@dont-email.me>
<fb65da9e-a175-4e9d-8749-b5d45e5ceeb3n@googlegroups.com>
<ucnogj$2povs$1@dont-email.me> <20230830122002.133@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 31 Aug 2023 09:18:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7c3ea83124750b7bb0478a35817b0183";
logging-data="3352860"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gxD0V80eqsN8IkwRktGIygQcRzTDtlwc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:+TZHF+DsrBQ9ymD+MHHUFxkUA0o=
Content-Language: en-GB
In-Reply-To: <20230830122002.133@kylheku.com>
 by: David Brown - Thu, 31 Aug 2023 09:18 UTC

On 30/08/2023 21:41, Kaz Kylheku wrote:
> On 2023-08-30, David Brown <david.brown@hesbynett.no> wrote:
>> On 30/08/2023 14:04, Malcolm McLean wrote:
>>> You call the standard library in most C projects.
>>
>> You do not /write/ the standard library for most C projects.
>>
>>> So the argument is that you should match the standard library style.
>>
>> The argument is worthless.
>>
>>> The alternative argument is that you should deliberately not match
>>> the standard library style, to make it obvious which calls are standard
>>> library calls and which are not.
>>
>> That is equally worthless as an argument.
>
> Coding conventions are arbitrarily chosen, an enforced not by arguments
> but authority: ranging from "your patch is rejected" to "write like this
> or find work somewhere else".
>

Coding conventions should certainly /not/ be chosen arbitrarily. But
once chosen, it is usually important to follow them (or to justify cases
where you deviate from them).

Considerations when choosing a coding convention include branch norms,
application area, existing projects, team makeup (including experience
levels), enforceability, and compatibility with other languages.
Sometimes price is a factor too - there are commercially available
coding standards.

The details of coding conventions themselves should be take into account
readability, maintainability, safety, tool options, and target details,
amongst other things. Some coding conventions are very loose and cover
only a few points, others are detailed and rigid.

As much as possible, all choices involved should be active decisions
based on good arguments - not arbitrarily chosen.

> But there exists a consistency argument: if you don't conform to the
> coding convention, then code becomes harder to work with. (As real
> experience with mixed style codebases informs us.)

Yes.

>
> If the naming recommended by the coding convention is at odds with the
> language, then that prevents maximal consistency from being reached.
>

Yes.

That is an issue for some languages, where there are restrictions on the
identifiers. If your project involves several languages, and some have
specific requirements (such as types start with capitals, or variables
must start with a lower case letter), consistency can be hard.
Fortunately, C has no conventions or rules (other than the characters
allowed), so you will never be "at odds" with the C language.

> If consistency is good, globally maximal consistency is better than
> locally maximal consistency.
>

No, not necessarily. Or at least, the consistency is not a major factor
compared to other concerns.

> Thus there is exists a consistency argument against choosing
> a CamelCase naming convention in a brand new C project with zero
> legacy code.
>

I agree there is such an argument - and it is worth considering. After
due consideration, I think it is a worthless argument.

There is no standard in C in regards to naming convention except for
having macros named in all-caps. (And I think that convention is a bad
one, and do not follow it because I rate other factors as more important
than consistency with a poor choice.)

Now, if you want to argue that you find CamelCase (or camelCase) harder
to read, then that is a /good/ argument. Again, it might not be the
overriding factor - but it is a far better reason than "global
consistency" with some pure imaginary "global C standard".

Re: Named function arguments (Was : C vs Haskell for XML parsing)

<ucpqt4$37q88$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Named function arguments (Was : C vs Haskell for XML parsing)
Date: Thu, 31 Aug 2023 12:43:48 +0200
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <ucpqt4$37q88$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <9OdIB8bvkgNvRPt7n@bongo-ra.co>
<20230830124510.831@kylheku.com> <=cpNTIYn=xLPR00Wq@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 31 Aug 2023 10:43:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7c3ea83124750b7bb0478a35817b0183";
logging-data="3401992"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190JLT+Xz+po/RjWYjw8UsyWJGYLsOV1gQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:ufHStTjmoiAcZi6AHCqdje9XzSw=
In-Reply-To: <=cpNTIYn=xLPR00Wq@bongo-ra.co>
Content-Language: en-GB
 by: David Brown - Thu, 31 Aug 2023 10:43 UTC

On 30/08/2023 22:07, Spiros Bousbouras wrote:
> On Wed, 30 Aug 2023 19:53:02 -0000 (UTC)
> Kaz Kylheku <864-117-4973@kylheku.com> wrote:

>> - ABI concerns: binary compatibility now dominated by rules for
>> structure passing.
>>
>> - Poor performance in ABIs that don't use registers for struct passing,
>> even for small structs.
>
> I said
> the wrapper function take as a single argument a pointer to struct
>

The wrapper function could be an inline function in a header, along with
the struct definition. Then there would be no ABI concerns because only
the original ABI is used - any overheads due to the struct and and
wrapper disappear.

Re: C vs Haskell for XML parsing

<861qfjtov4.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Thu, 31 Aug 2023 04:47:43 -0700
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <861qfjtov4.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me> <20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com> <ucjei2$1tv7s$1@dont-email.me> <20230828182115.305@kylheku.com> <uckeel$26q6m$1@dont-email.me> <uckumo$29oe0$1@dont-email.me> <875y4xboly.fsf@nosuchdomain.example.com> <ucn6hi$2n2kb$1@dont-email.me> <ucnqv5$2q4fv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="49a0c7fba7d7c0f06cea865d80b29294";
logging-data="3450339"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18MDHxqok3FEhD0mmtaeYnuW0EZ/m/9HnI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:51HsWDemPdeyzQFxuyaD5fTbMZs=
sha1:xCHupUlTuKPtXOk9kLG4ReYmyl0=
 by: Tim Rentsch - Thu, 31 Aug 2023 11:47 UTC

James Kuyper <jameskuyper@alumni.caltech.edu> writes:

[...]

> The defining characteristic of a C extension is "A conforming
> implementation may have extensions (including additional library
> functions), provided they do not alter the behavior of any
> strictly conforming program." [...]
>
> I would have preferred that they call these "conforming"
> extensions - that is, extensions that do not render the
> implementation non-conforming. I think it would be appropriate
> to talk about extensions that render an implementation
> non-conforming, calling them "non-conforming extensions".

That's a silly idea. Without imposing any limitations on what
may be included or excluded, a "non-conforming extension" could
be anything (literally anything) at all. It could look like C.
It could look like Fortran, or Ada. It could /be/ Fortran or
Ada. It could look exactly like C, but always have undefined
behavior. Or it could look exactly like C, but always just exit
immediately (with EXIT_SUCCESS on Tuesdays, and EXIT_FAILURE the
rest of the time). None of these possibilities merit being
called an extension of C, non-conforming or otherwise.

Re: Named function arguments (Was : C vs Haskell for XML parsing)

<FH2PvBd=Z3nt=LKcX@bongo-ra.co>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Re: Named function arguments (Was : C vs Haskell for XML parsing)
Date: Thu, 31 Aug 2023 18:41:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <FH2PvBd=Z3nt=LKcX@bongo-ra.co>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <uca3sh$p9c$1@dont-email.me>
<878r9zeynn.fsf@nosuchdomain.example.com> <AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me> <H2oGM.827787$TPw2.680260@fx17.iad>
<ucd5kt$kl1p$1@dont-email.me> <20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me> <20230827151627.814@kylheku.com>
<87edjocbqj.fsf@nosuchdomain.example.com> <86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <9OdIB8bvkgNvRPt7n@bongo-ra.co> <20230830124510.831@kylheku.com>
<=cpNTIYn=xLPR00Wq@bongo-ra.co> <ucof1i$2tbqe$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 31 Aug 2023 18:41:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="953f931c38f7411195d543c971be568c";
logging-data="3583667"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3AFDZsviPMyJxKKrkRxzG"
Cancel-Lock: sha1:Auu4s8VaZC6RMUgHkYAZf98Ka8w=
In-Reply-To: <ucof1i$2tbqe$1@dont-email.me>
X-Server-Commands: nowebcancel
X-Organisation: Weyland-Yutani
 by: Spiros Bousbouras - Thu, 31 Aug 2023 18:41 UTC

On Wed, 30 Aug 2023 23:15:13 +0100
Richard Harnden <richard.nospam@gmail.com> wrote:
> On 30/08/2023 21:07, Spiros Bousbouras wrote:
>
> >
> > I said
> > the wrapper function take as a single argument a pointer to struct
> >
>
> Can a struct have the same qualifiers as a function?
>
> I mean, say you have:
> void foo(const char * restrict bar);
>
> Can you have ...?
>
> struct foo
> {
> const char * restrict bar;
> };
>
> void foos(struct foo foo);
>
> ... ?
>
> Does the const/restrict'ness survive?

The syntax allows it but to what extent the semantics are different , I'm not
sure. For restrict I'm not clear about the details even if it's not a member
of a structure.


devel / comp.lang.c / C vs Haskell for XML parsing

Pages:123456789101112
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor