Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Research is to see what everybody else has seen, and think what nobody else has thought.


devel / comp.lang.c / Re: C isn't a programming language

SubjectAuthor
* C isn't a programming languageRichard Harnden
+* Re: C isn't a programming languageScott Lurndal
|+* Re: C isn't a programming languageGuillaume
||+* Re: C isn't a programming languageKeith Thompson
|||+* Re: C isn't a programming languageBGB
||||`* Re: C isn't a programming languageKeith Thompson
|||| +- Re: C isn't a programming languageBGB
|||| `- Re: C isn't a programming languageGuillaume
|||`* Re: C isn't a programming languageantispam
||| +* Re: C isn't a programming languageGuillaume
||| |`* Re: C isn't a programming languageantispam
||| | `* Re: C isn't a programming languageGuillaume
||| |  +- Re: C isn't a programming languageStefan Ram
||| |  +* Re: C isn't a programming languageantispam
||| |  |`- Re: C isn't a programming languageKaz Kylheku
||| |  `- Re: C isn't a programming languageTim Rentsch
||| `- Re: C isn't a programming languageTim Rentsch
||+- Re: C isn't a programming languageKaz Kylheku
||`* Re: C isn't a programming languageBart
|| `* Re: C isn't a programming languageManfred
||  +* Re: C isn't a programming languageBonita Montero
||  |`* Re: C isn't a programming languageMalcolm McLean
||  | +- Re: C isn't a programming languageBen Bacarisse
||  | `- Re: C isn't a programming languageBonita Montero
||  `* Re: C isn't a programming languageBart
||   +* Re: C isn't a programming languageDavid Brown
||   |`* Re: C isn't a programming languageBart
||   | `- Re: C isn't a programming languageDavid Brown
||   `* Re: C isn't a programming languageManfred
||    `* Re: C isn't a programming languageBart
||     +- Re: C isn't a programming languageBart
||     +* Re: C isn't a programming languageBen Bacarisse
||     |`* Re: C isn't a programming languageManfred
||     | `* Re: C isn't a programming languageBen Bacarisse
||     |  `- Re: C isn't a programming languageManfred
||     `* Re: C isn't a programming languageDavid Brown
||      `* Re: C isn't a programming languageKaz Kylheku
||       `* Re: C isn't a programming languageDavid Brown
||        `* Re: C isn't a programming languageBen Bacarisse
||         +* Re: C isn't a programming languageDavid Brown
||         |`- Re: C isn't a programming languageMalcolm McLean
||         `- Re: C isn't a programming languageKaz Kylheku
|+- Re: C isn't a programming languageKeith Thompson
|+- Re: C isn't a programming languagerek2 hispagatos
|`- Re: C isn't a programming languageantispam
+* Re: C isn't a programming languageBen Bacarisse
|`* Re: C isn't a programming languageBart
| +* Re: C isn't a programming languageJack Noddy
| |`- Re: C isn't a programming languageBart
| `* Re: C isn't a programming languageBen Bacarisse
|  `* Re: C isn't a programming languageGuillaume
|   `- Re: C isn't a programming languageBart
+- Re: C isn't a programming languageIan Pilcher
+* Re: C isn't a programming languagerek2 hispagatos
|`- Re: C isn't a programming languageBonita Montero
+* Re: C isn't a programming languageStefan Ram
|+- Re: C isn't a programming languageBen Bacarisse
|`* Re: C isn't a programming languageBonita Montero
| +* Re: C isn't a programming languageLew Pitcher
| |+* Re: C isn't a programming languageBonita Montero
| ||`* Re: C isn't a programming languageLew Pitcher
| || +* Re: C isn't a programming languageStefan Ram
| || |`- Re: C isn't a programming languageScott Lurndal
| || +- Re: C isn't a programming languageStefan Ram
| || `- Re: C isn't a programming languageBonita Montero
| |+- Re: C isn't a programming languageManfred
| |`* Re: C isn't a programming languageBen Bacarisse
| | `- Re: C isn't a programming languageScott Lurndal
| `- Re: C isn't a programming languagerek2 hispagatos
+- Re: C isn't a programming languageStefan Ram
+- Re: C isn't a programming languageJorgen Grahn
`- Re: C isn't a programming languagefir

Pages:123
Re: C isn't a programming language

<t1nq04$hrv$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!NWBQctYDi7NlCOQPK8oY6A.user.46.165.242.75.POSTED!not-for-mail
From: mess...@bottle.org (Guillaume)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Sat, 26 Mar 2022 20:36:31 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t1nq04$hrv$1@gioia.aioe.org>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <87zglfyz85.fsf@nosuchdomain.example.com>
<t1mtp0$1pv4$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="18303"; posting-host="NWBQctYDi7NlCOQPK8oY6A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: fr
 by: Guillaume - Sat, 26 Mar 2022 19:36 UTC

Le 26/03/2022 à 12:34, antispam@math.uni.wroc.pl a écrit :
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> Guillaume <message@bottle.org> writes:
>>> Le 24/03/2022 ? 16:45, Scott Lurndal a ?crit?:
>>>> Richard Harnden <richard.nospam@gmail.com> writes:
>>>>> "C: Everyone's favourite programming language isn't a programming language"
>>>>>
>>>>> Erm ... <https://www.theregister.com/2022/03/23/c_not_a_language>
>>>> The article doesn't make a whole lot of sense - it's basically just
>>>> bitching because swift and rust can't do everything that C can.
>>>
>>> And you're putting it lightly.
>>> Of course, first thing, without even reading it, is questioning the
>>> relevance of such articles written by heavy proponents of
>>> "alternative" languages. How much more biased can one be?
>>>
>>> Digging a bit deeper, there is nothing much to even take from this
>>> short article. It's pretty shallow.
>>>
>>> - C is difficult to parse? C declarations are, for instance, not
>>> exactly easy, but it's only very moderately difficult. You can have
>>> fun with this to get an idea: https://cdecl.org/ . I has never made
>>> it a problem to write a C compiler. There are more of them out there
>>> than for any other language, I think. OTOH, there is, AFAIK, only one
>>> implementation of Rust. Which to me is in itself a problem. I'm
>>> curious to see if it ever even gets to the point of having other
>>> competing implementations.
>>
>> It's probably referring to the typedef issue.
>>
>> In the absence of typedefs, type names consist of keywords and
>> punctuation. A typedef (a feature that was added to the language
>> after the syntax had been established) creates a type name that's an
>> identifier. It's impossible to parse something that uses a typedef name
>> without knowing that it's a typedef name. In effect a typedef adds a
>> context-sensitive keyword to the grammar. The parser needs to query the
>> symbol table.
>
> Using symbol table is just one of possible solutions. Another
> one is to note that true ambiguities are really semantic, so
> parser can return tree faithful to all possible meaning. For
> example, cast versus function call is semantic problem so
> parser can return 'call_or_cast' and let semantic phase
> to decide.

Sure. Then it's down to wanking about what exactly is the parsing part
in your analyzer and what you want done with it. If you're happy with
the output of your "parser" to lack fundamental syntactic information
(yes, I consider determining whether a given token is a type, a
variable, a qualifier, etc, is a syntactic information), why not. That
can always be analyzed later. That doesn't change squat about the final
output of your analysis. And since the output of said "parser" would be
pretty useless by itself, this structure is just an implementation
choice. Possibly making it look more "academically" correct. (Yeah I've
read endless discussions about what parsing exactly was supposed to be.)

Re: C isn't a programming language

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

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Sat, 26 Mar 2022 20:32:52 +0000
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <87pmm84fpn.fsf@bsb.me.uk>
References: <t1i34t$m94$1@dont-email.me>
<programming-language-20220326131605@ram.dialup.fu-berlin.de>
<t1n2ks$pe7$1@dont-email.me> <t1n4gg$i2a$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="a8e2207611f2730082c6cd19dcc49545";
logging-data="30603"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ctLAEX6A/GarGBb0kmyzWcFoUeB+sSRg="
Cancel-Lock: sha1:XSbkkkehMp5gApnr2e/zR9GEtmE=
sha1:IOE7FirLjb/YUA2Pa86G6ZDIJDI=
X-BSB-Auth: 1.5d37ff9f37fbc1a6eb4b.20220326203252GMT.87pmm84fpn.fsf@bsb.me.uk
 by: Ben Bacarisse - Sat, 26 Mar 2022 20:32 UTC

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

> On Sat, 26 Mar 2022 13:58:04 +0100, Bonita Montero wrote:
>
>>> I am in conflict with people who claim that HTML is not a
>>> programming language, so I have written a German-language
>>> text explaining why HTML is indeed a programming language.
>>> But for C, I'm at a loss, I have no such text prepared for C!
>>
>> A program has a control flow.
>> HTML is a static data-structure without a control flow.
>> So you can't program in HTML.
>
> I disagree. In general, a "program" provides instructions to
> automation (usually computer automation) and need not contain
> control flow. HTML instructs a "web browser" (automated tool) on
> how to display data.

Since HTML makes sense in a context with no concept of "display (spoken,
Braille machine, etc) I think it's odd to say that HTML "instructs" the
display software. I don't think it's clear cut, mind, but I would want
a stronger case to made before changing my mind.

I'd ask you the same question I asked Stefan Ram: what's the minimum
markup you would accept? None? Is plain ASCII text instructing the
display software?

(This is not a trick question. I like to understand positions that are
at odds with my intuition, and investigating the corner cases is useful
here.)

> In that respect, you can write HTML, and the
> resulting text will act as a "program" for a web browser. A
> similar argument can be made for GCODE (the way 3D printers and
> automated mills are "programmed") or even the punch cards used
> to control a Jacquard loom.
>
> However, most here (of which I am one) would probably first think
> of code written in a Turing-complete language as a "program". A
> Turing-complete language /does/ have control flow. If we restrict
> "programming" to "writing in Turing-complete languages", then we
> exclude HTML, GCODE, and a large number of other human-planned
> automated process controls from "programming".

I don't think most people would really insist on a notation that's
Turing complete. For example, one designed so algorithms always
terminate will look for all the world like a programming language. And
you can have almost as many bugs and difficulties in programming using
it.

--
Ben.

Re: C isn't a programming language

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

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Sat, 26 Mar 2022 20:43:11 +0000
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <87ils04f8g.fsf@bsb.me.uk>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="a8e2207611f2730082c6cd19dcc49545";
logging-data="30603"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19a5xdAP1b/JY+NZuda5Pee4VxUJ0nf1VM="
Cancel-Lock: sha1:0PCTAPjuOoji64bwKQsBAslIqzQ=
sha1:Qk2bqrIKw8E69pcSo3aCeqTRh7E=
X-BSB-Auth: 1.87b7f5c5f3582726d43f.20220326204311GMT.87ils04f8g.fsf@bsb.me.uk
 by: Ben Bacarisse - Sat, 26 Mar 2022 20:43 UTC

Bart <bc@freeuk.com> writes:

> This is the kind of thing I'm talking about:
>
> void (*)(void)
> void (**)(void)
> void (***)(void)
> void *(*)(void)
> void **(*)(void)
>
> I wouldn't even know where to start with using typedefs to express
> these more clearly; perhaps:
>
> typedef void F(void);
> typedef void* G(void);
> typedef void** H(void);

I wouldn't do that. I would (a) use a good name, and (b) not worry
about the "inner" pointers at all:

// A simple action is a parameterless function that returns nothing:
typedef void simple_action(void);

simple_action *action_ptr;
simple_action **indirect_action_ptr;

// and I won't try to invent a name for a pointer to a pointer to a
// pointer to an action. It's most likely to be result parameter.

// The data are accessed with parameterless functions that return
// universal pointers:
typedef void *data_access_function(void);

data_access_function *accessor_ptr;
data_access_function **indirect_accessor_ptr;

--
Ben.

Re: C isn't a programming language

<k%L%J.258374$3jp8.121138@fx33.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx33.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 isn't a programming language
Newsgroups: comp.lang.c
References: <t1i34t$m94$1@dont-email.me> <programming-language-20220326131605@ram.dialup.fu-berlin.de> <t1n2ks$pe7$1@dont-email.me> <t1n4gg$i2a$1@dont-email.me> <87pmm84fpn.fsf@bsb.me.uk>
Lines: 36
Message-ID: <k%L%J.258374$3jp8.121138@fx33.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 26 Mar 2022 21:57:36 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 26 Mar 2022 21:57:36 GMT
X-Received-Bytes: 2565
 by: Scott Lurndal - Sat, 26 Mar 2022 21:57 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>
>> On Sat, 26 Mar 2022 13:58:04 +0100, Bonita Montero wrote:
>>
>>>> I am in conflict with people who claim that HTML is not a
>>>> programming language, so I have written a German-language
>>>> text explaining why HTML is indeed a programming language.
>>>> But for C, I'm at a loss, I have no such text prepared for C!
>>>
>>> A program has a control flow.
>>> HTML is a static data-structure without a control flow.
>>> So you can't program in HTML.
>>
>> I disagree. In general, a "program" provides instructions to
>> automation (usually computer automation) and need not contain
>> control flow. HTML instructs a "web browser" (automated tool) on
>> how to display data.
>
>Since HTML makes sense in a context with no concept of "display (spoken,
>Braille machine, etc) I think it's odd to say that HTML "instructs" the
>display software. I don't think it's clear cut, mind, but I would want
>a stronger case to made before changing my mind.

HTML is really just a non-canonical XML document. It is a descriptive
layout language, more verbose than, but little different from RUNOFF.

Now you can build a flow around XML; I once worked on a B2B solution
(written in Java) that accepted XML documents as input, applied one or
more XSL style sheets to the document to transform it into database queries,
updates, or HTML display instructions using data flow technology.

One would drag-n-drop components from a toolbox, link them together
and customize the queries, provides transformations (style-sheets)
to produce output HTML, or output XML or output text. This was basically
a visual programming language.

Re: C isn't a programming language

<t1o6qn$1eub$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!NZ87pNe1TKxNDknVl4tZhw.user.46.165.242.91.POSTED!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Sat, 26 Mar 2022 23:15:35 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t1o6qn$1eub$1@gioia.aioe.org>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad> <t1ibau$mtp$1@gioia.aioe.org> <87zglfyz85.fsf@nosuchdomain.example.com> <t1mtp0$1pv4$1@gioia.aioe.org> <t1nq04$hrv$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="48075"; posting-host="NZ87pNe1TKxNDknVl4tZhw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: tin/2.4.5-20201224 ("Glen Albyn") (Linux/5.10.0-9-amd64 (x86_64))
Cancel-Lock: sha1:HdXfAMwcT2r4VySSXyKiQOqa/Gw=
X-Notice: Filtered by postfilter v. 0.9.2
 by: antis...@math.uni.wroc.pl - Sat, 26 Mar 2022 23:15 UTC

Guillaume <message@bottle.org> wrote:
> Le 26/03/2022 ? 12:34, antispam@math.uni.wroc.pl a ?crit?:
> > Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> >> Guillaume <message@bottle.org> writes:
> >>> Le 24/03/2022 ? 16:45, Scott Lurndal a ?crit?:
> >>>> Richard Harnden <richard.nospam@gmail.com> writes:
> >>>>> "C: Everyone's favourite programming language isn't a programming language"
> >>>>>
> >>>>> Erm ... <https://www.theregister.com/2022/03/23/c_not_a_language>
> >>>> The article doesn't make a whole lot of sense - it's basically just
> >>>> bitching because swift and rust can't do everything that C can.
> >>>
> >>> And you're putting it lightly.
> >>> Of course, first thing, without even reading it, is questioning the
> >>> relevance of such articles written by heavy proponents of
> >>> "alternative" languages. How much more biased can one be?
> >>>
> >>> Digging a bit deeper, there is nothing much to even take from this
> >>> short article. It's pretty shallow.
> >>>
> >>> - C is difficult to parse? C declarations are, for instance, not
> >>> exactly easy, but it's only very moderately difficult. You can have
> >>> fun with this to get an idea: https://cdecl.org/ . I has never made
> >>> it a problem to write a C compiler. There are more of them out there
> >>> than for any other language, I think. OTOH, there is, AFAIK, only one
> >>> implementation of Rust. Which to me is in itself a problem. I'm
> >>> curious to see if it ever even gets to the point of having other
> >>> competing implementations.
> >>
> >> It's probably referring to the typedef issue.
> >>
> >> In the absence of typedefs, type names consist of keywords and
> >> punctuation. A typedef (a feature that was added to the language
> >> after the syntax had been established) creates a type name that's an
> >> identifier. It's impossible to parse something that uses a typedef name
> >> without knowing that it's a typedef name. In effect a typedef adds a
> >> context-sensitive keyword to the grammar. The parser needs to query the
> >> symbol table.
> >
> > Using symbol table is just one of possible solutions. Another
> > one is to note that true ambiguities are really semantic, so
> > parser can return tree faithful to all possible meaning. For
> > example, cast versus function call is semantic problem so
> > parser can return 'call_or_cast' and let semantic phase
> > to decide.
>
> Sure. Then it's down to wanking about what exactly is the parsing part
> in your analyzer and what you want done with it. If you're happy with
> the output of your "parser" to lack fundamental syntactic information
> (yes, I consider determining whether a given token is a type, a
> variable, a qualifier, etc, is a syntactic information), why not.

There is nothing syntactic in types. Language may decide to clearly
separate types from rest of syntax, many do so but C is in the camp
that does not make such distintion.

> That
> can always be analyzed later. That doesn't change squat about the final
> output of your analysis. And since the output of said "parser" would be
> pretty useless by itself, this structure is just an implementation
> choice.

Sometimes it is the only choice. I learned about the technique from
description of C compiler that wanted to offer alternative macro
processor working on level of parse trees. Clearly, what is type
is known only after macro processing, so the the symbol table hack
would not work. I used it in Pascal compiler. Compiler was supposed
to accept several syntax extentions which led to fairly complicated
grammar. In turn this needed more powerful parsing technology (GLR)
with unlimited lookahead. Again, lookahead meant that things could
be parsed before semantic info for corresponding tokens where inserted
in symbol table.

> Possibly making it look more "academically" correct. (Yeah I've
> read endless discussions about what parsing exactly was supposed to be.)

Parsing maps stream of tokens to a tree. Semantics is assigning meaning
to the tree. Of course, if you have single pass compiler, then it
is tempting to tightly couple semantic processing with syntax,
in particular use semantic info for parsing.

--
Waldek Hebisch

Re: C isn't a programming language

<t1oms4$556$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!NWBQctYDi7NlCOQPK8oY6A.user.46.165.242.75.POSTED!not-for-mail
From: mess...@bottle.org (Guillaume)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Sun, 27 Mar 2022 05:49:24 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t1oms4$556$1@gioia.aioe.org>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <87zglfyz85.fsf@nosuchdomain.example.com>
<t1mtp0$1pv4$1@gioia.aioe.org> <t1nq04$hrv$1@gioia.aioe.org>
<t1o6qn$1eub$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="5286"; posting-host="NWBQctYDi7NlCOQPK8oY6A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Content-Language: fr
X-Notice: Filtered by postfilter v. 0.9.2
 by: Guillaume - Sun, 27 Mar 2022 03:49 UTC

Le 27/03/2022 à 00:15, antispam@math.uni.wroc.pl a écrit :
> There is nothing syntactic in types. Language may decide to clearly
> separate types from rest of syntax, many do so but C is in the camp
> that does not make such distintion.

Uh. What are you on about? Yes, knowing what part is a type and what
part is a variable identifier (for instance) in an expression *is* a
syntax matter. Just like knowing what is a verb and what is a subject,
etc, is a syntax matter in natural languages. What camp are you talking
about?

As the earlier, simple and telling example showed:

x y;

You absolutely can't make any syntactic sense of this unless you know
what x and y are.

Without a symbol table, the output of your parser with the above will
just be a list of tokens, so such a parser essentially becomes a
tokenizer only.

Re: C isn't a programming language

<t1pc4o$79c$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Sun, 27 Mar 2022 11:52:23 +0200
Organization: A noiseless patient Spider
Lines: 88
Message-ID: <t1pc4o$79c$1@dont-email.me>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 27 Mar 2022 09:52:24 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="dad4aecdff7afea15a250dc6b6858979";
logging-data="7468"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GKkN8mS/egiNzB4ckKDjO4P5uttzLc4k="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:TbeUtkcgOPkZHOpIFgErySLlRqI=
In-Reply-To: <t1ngjs$82m$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Sun, 27 Mar 2022 09:52 UTC

On 26/03/2022 17:56, Bart wrote:
> On 26/03/2022 16:11, Manfred wrote:
>> On 3/25/2022 8:16 PM, Bart wrote:
>>> On 25/03/2022 18:17, Manfred wrote:
>> [...]
>>>>
>>>> More in general, it is about indirection. If a language's
>>>> declaration syntax allows for any combination of indirection
>>>> constructs, then things may get convoluted, but it's the type itself
>>>> that is convoluted, not necessarily the syntax's fault.
>>>>
>>>> And, obviously, typedefs make things a /lot/ easier.
>>>
>>> Typedefs should be used when they make sense for the project. If used
>>> to just to mitigate the awfulness of the type syntax, then something
>>> is wrong.
>>>
>>
>> Possibly, but.
>>
>> When writing a program, you are effectively modeling a problem domain.
>> Defining the data types of the information items that the problem
>> revolves around is a key step in such process.
>> In this perspective typedefs, together with user defined types, play a
>> very useful role in software design.
>>
>> If you come to a point where you have to handle some complex type only
>> once in your program, or you end up having a plethora of unrelated
>> cryptic types, then that is a good hint for looking at how good your
>> model is.
>
> This is the kind of thing I'm talking about:
>
>     void (*)(void)
>     void (**)(void)
>     void (***)(void)
>     void *(*)(void)
>     void **(*)(void)
>

I see your first problem. Who on earth needs types like these ones?
The first one, yes, but none of the others.

> I wouldn't even know where to start with using typedefs to express these
> more clearly; perhaps:

Problem number two - /you/ don't know how to use typedefs. Other people
do. Learn to use the features of C, rather than deciding in advance
that you don't like them and refusing to even try to use them.

>
>     typedef void F(void);
>     typedef void* G(void);
>     typedef void** H(void);
>

Problem number three - giving names like F, G, H does not help clarity.

When they have names like "FSort" or "comparison_func" or
"fp_redraw_callback", you've got something that adds to the program.

>     F*
>     F**
>     F***
>     G*
>     H**
>
> You start by first removing all the "*" inside the first set of
> parentheses. Then creating named types for distinct combinations of
> functions that follow. Then reinstating those "*" to each instance of
> that new type.
>
> However, this is rather going around the houses. It's also necessary to
> locate all instances of 'void(*)(void)' in a program, to ensure they all
> use the same typedef, even though they may be used for diverse purposes.
>

Typedef does not introduce a new type. A typedef is entirely compatible
with the underlying type, or other identical typedefs with different
names. (It is not a new type, and not strong typing - you need "struct"
or "union" for that.) So using a typedef doesn't affect compatibility
with existing code, and you don't have to change anything.

> IMV this does not improve matters, since you are now hunting global
> typedefs looking for what F or G might mean. It also doesn't help when
> `void(*)(void)` is used in an imported header than you aren't allowed to
> modify, or which employs its own typedef.

Re: C isn't a programming language

<sense-20220327122353@ram.dialup.fu-berlin.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: 27 Mar 2022 11:24:42 GMT
Organization: Stefan Ram
Lines: 15
Expires: 1 Apr 2023 11:59:58 GMT
Message-ID: <sense-20220327122353@ram.dialup.fu-berlin.de>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad> <t1ibau$mtp$1@gioia.aioe.org> <87zglfyz85.fsf@nosuchdomain.example.com> <t1mtp0$1pv4$1@gioia.aioe.org> <t1nq04$hrv$1@gioia.aioe.org> <t1o6qn$1eub$1@gioia.aioe.org> <t1oms4$556$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de qGNiIuPQLll4VIs/JZW+gQdi3oUfzw5AHrnUjYGa0RDa69
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Sun, 27 Mar 2022 11:24 UTC

Guillaume <message@bottle.org> writes:
>As the earlier, simple and telling example showed:
>x y;
>You absolutely can't make any syntactic sense of this unless you know
>what x and y are.

"Syntactic sense" is a bit vague, but what else could it be
than a <declaration> wherein "x" is the <declaration-specifiers>
and "y" is the <init-declarator-list>?

(Assuming it is a complete symbol; otherwise, it could be
the /ending/ of a declaration as in "static x y;" or as in
"struct x y;".)

Re: C isn't a programming language

<t1qg0r$efp$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!Puiiztk9lHEEQC0y3uUjRA.user.46.165.242.75.POSTED!not-for-mail
From: non...@add.invalid (Manfred)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Sun, 27 Mar 2022 22:04:42 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t1qg0r$efp$1@gioia.aioe.org>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<87ils04f8g.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="14841"; posting-host="Puiiztk9lHEEQC0y3uUjRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Manfred - Sun, 27 Mar 2022 20:04 UTC

On 3/26/2022 9:43 PM, Ben Bacarisse wrote:
> Bart <bc@freeuk.com> writes:
>
>> This is the kind of thing I'm talking about:
>>
>> void (*)(void)
>> void (**)(void)
>> void (***)(void)
>> void *(*)(void)
>> void **(*)(void)
>>

Out of context, changing the notation for these types has no meaning.

>> I wouldn't even know where to start with using typedefs to express
>> these more clearly; perhaps:
>>
>> typedef void F(void);
>> typedef void* G(void);
>> typedef void** H(void);
>
> I wouldn't do that. I would (a) use a good name, and (b) not worry
> about the "inner" pointers at all:
>
> // A simple action is a parameterless function that returns nothing:
> typedef void simple_action(void);
>
> simple_action *action_ptr;
> simple_action **indirect_action_ptr;
>
> // and I won't try to invent a name for a pointer to a pointer to a
> // pointer to an action. It's most likely to be result parameter.
>
> // The data are accessed with parameterless functions that return
> // universal pointers:
> typedef void *data_access_function(void);
>
> data_access_function *accessor_ptr;
> data_access_function **indirect_accessor_ptr;
>

(a) a "good name" makes sense only in some context, i.e. when you are
mapping concepts from a problem domain to C types - actions and
accessors in your example.

(b) might well be often good advice. I think it still depends on
context, though. Sometimes the following might make sense too:

typedef simple_action **simple_action_ref;

Re: C isn't a programming language

<877d8f17ej.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Sun, 27 Mar 2022 21:12:52 +0100
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <877d8f17ej.fsf@bsb.me.uk>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<87ils04f8g.fsf@bsb.me.uk> <t1qg0r$efp$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="0b1bfd64e7a9919f9616c2cd2b028c77";
logging-data="11775"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1gcQyg84Sd8tX8whsiiaWZ2VukYiq8Io="
Cancel-Lock: sha1:0F4x1Qd+zN9droRns2CQcN0DJBg=
sha1://2pri35h2HN9mkULg1Ue7lHAlA=
X-BSB-Auth: 1.77172bb83a8a6c0405e3.20220327211252BST.877d8f17ej.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 27 Mar 2022 20:12 UTC

Manfred <noname@add.invalid> writes:

> On 3/26/2022 9:43 PM, Ben Bacarisse wrote:
>> Bart <bc@freeuk.com> writes:
>>
>>> This is the kind of thing I'm talking about:
>>>
>>> void (*)(void)
>>> void (**)(void)
>>> void (***)(void)
>>> void *(*)(void)
>>> void **(*)(void)
>>>
>
> Out of context, changing the notation for these types has no meaning.
>
>>> I wouldn't even know where to start with using typedefs to express
>>> these more clearly; perhaps:
>>>
>>> typedef void F(void);
>>> typedef void* G(void);
>>> typedef void** H(void);
>> I wouldn't do that. I would (a) use a good name, and (b) not worry
>> about the "inner" pointers at all:
>> // A simple action is a parameterless function that returns nothing:
>> typedef void simple_action(void);
>> simple_action *action_ptr;
>> simple_action **indirect_action_ptr;
>> // and I won't try to invent a name for a pointer to a pointer to a
>> // pointer to an action. It's most likely to be result parameter.
>> // The data are accessed with parameterless functions that return
>> // universal pointers:
>> typedef void *data_access_function(void);
>> data_access_function *accessor_ptr;
>> data_access_function **indirect_accessor_ptr;
>>
>
> (a) a "good name" makes sense only in some context, i.e. when you are
> mapping concepts from a problem domain to C types - actions and
> accessors in your example.

Agreed. I was forced to choose are a vague "good name" because there
was no context.

> (b) might well be often good advice. I think it still depends on
> context, though. Sometimes the following might make sense too:
>
> typedef simple_action **simple_action_ref;

Yes, that might make sense but I am not a fan of hiding a top-level
pointer in a typedef. The notation (a simple *) needs no contraction
and C's pointers are so low-level and lead to what would be mysterious
semantics for any other type (I'm thinking aliasing) that I tend to
avoid it.

--
Ben.

Re: C isn't a programming language

<t1qrr9$gt0$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!Puiiztk9lHEEQC0y3uUjRA.user.46.165.242.75.POSTED!not-for-mail
From: non...@add.invalid (Manfred)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 28 Mar 2022 01:26:32 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t1qrr9$gt0$1@gioia.aioe.org>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<87ils04f8g.fsf@bsb.me.uk> <t1qg0r$efp$1@gioia.aioe.org>
<877d8f17ej.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="17312"; posting-host="Puiiztk9lHEEQC0y3uUjRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Manfred - Sun, 27 Mar 2022 23:26 UTC

On 3/27/2022 10:12 PM, Ben Bacarisse wrote:
> Manfred <noname@add.invalid> writes:
>
[...]
>
>> (b) might well be often good advice. I think it still depends on
>> context, though. Sometimes the following might make sense too:
>>
>> typedef simple_action **simple_action_ref;
>
> Yes, that might make sense but I am not a fan of hiding a top-level
> pointer in a typedef. The notation (a simple *) needs no contraction
> and C's pointers are so low-level and lead to what would be mysterious
> semantics for any other type (I'm thinking aliasing) that I tend to
> avoid it.
>

Good point.

Re: C isn't a programming language

<20220328011524.8@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 28 Mar 2022 08:23:21 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <20220328011524.8@kylheku.com>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<t1pc4o$79c$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 28 Mar 2022 08:23:21 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="9f3df9d3c5d46b28e70404db37378c66";
logging-data="8265"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1923bC+AWYQxkSKHU6jqXgQNmEOOppyr8I="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:0kqtB9Dysvzzsj1KVnzV9XvU2Oc=
 by: Kaz Kylheku - Mon, 28 Mar 2022 08:23 UTC

On 2022-03-27, David Brown <david.brown@hesbynett.no> wrote:
> On 26/03/2022 17:56, Bart wrote:
>> This is the kind of thing I'm talking about:
>>
>>     void (*)(void)
>>     void (**)(void)
>>     void (***)(void)
>>     void *(*)(void)
>>     void **(*)(void)
>>
>
> I see your first problem. Who on earth needs types like these ones?
> The first one, yes, but none of the others.

The second one could be the pointer to the element of an array,
which is of function pointers. This is reasonably common.

for (void (**iter)(void) = initfun_table; *iter; iter++)
(**iter)();

// (*iter)() would work, but if we have multiple stars going on
// might as well match decl and use.

Re: C isn't a programming language

<t1sfcd$41u$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 28 Mar 2022 16:06:05 +0200
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <t1sfcd$41u$1@dont-email.me>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<t1pc4o$79c$1@dont-email.me> <20220328011524.8@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 28 Mar 2022 14:06:05 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0303aa88abeb82fa97faf73dd319b0f1";
logging-data="4158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Lz9VdP9Z3b5G8tsyD92dDjsTej4JKEAk="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:mEVI8FeyiWB1kXlHCyRPbD3AaCg=
In-Reply-To: <20220328011524.8@kylheku.com>
Content-Language: en-GB
 by: David Brown - Mon, 28 Mar 2022 14:06 UTC

On 28/03/2022 10:23, Kaz Kylheku wrote:
> On 2022-03-27, David Brown <david.brown@hesbynett.no> wrote:
>> On 26/03/2022 17:56, Bart wrote:
>>> This is the kind of thing I'm talking about:
>>>
>>>     void (*)(void)
>>>     void (**)(void)
>>>     void (***)(void)
>>>     void *(*)(void)
>>>     void **(*)(void)
>>>
>>
>> I see your first problem. Who on earth needs types like these ones?
>> The first one, yes, but none of the others.
>
> The second one could be the pointer to the element of an array,
> which is of function pointers. This is reasonably common.
>
> for (void (**iter)(void) = initfun_table; *iter; iter++)
> (**iter)();
>
> // (*iter)() would work, but if we have multiple stars going on
> // might as well match decl and use.
>

Of course it is always possible to find use-cases for any of these - and
the less complex, the more common. But nothing (other than knee-jerk
prejudice) hinders a programmer from using typedefs here if it makes the
code simpler and clearer (noting that styles and preferences vary
considerably). So I'd have something like:

enum { len_initfun_table = 10 };
typedef void (*FInitFunc)(void);

FInitFunc initfun_table[len_initfun_table];

void init_all(void)
{ for (int i = 0; i < len_initfun_table; i++) {
initfun_table[i]();
}
}

I prefer array syntax for arrays. I prefer named types to complex ones.
Of course other people may prefer to write code in different ways (and
the "best" way to write it can depend on other parts of the code outside
these snippets, such as how the "init" functions are assigned). But I'm
at a loss to understand how someone (i.e., Bart) can complain that C's
type syntax is difficult, and then claim that typedef makes it worse or
is a bad idea.

Re: C isn't a programming language

<874k3iywh8.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 28 Mar 2022 15:37:07 +0100
Organization: A noiseless patient Spider
Lines: 69
Message-ID: <874k3iywh8.fsf@bsb.me.uk>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<t1pc4o$79c$1@dont-email.me> <20220328011524.8@kylheku.com>
<t1sfcd$41u$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="d27dd257eb8785961784696f3734f9eb";
logging-data="14426"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cl0SaFa3BqpYFIHyLHoZ+Pxijk7ouceY="
Cancel-Lock: sha1:IkowW3N6Bzdl3dnHuuYFbzOxkZc=
sha1:Pd0lYM/2MzdudCqBzrVM+z+dgsQ=
X-BSB-Auth: 1.a9d2d3daef7ebe1e4688.20220328153707BST.874k3iywh8.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 28 Mar 2022 14:37 UTC

David Brown <david.brown@hesbynett.no> writes:

> On 28/03/2022 10:23, Kaz Kylheku wrote:
>> On 2022-03-27, David Brown <david.brown@hesbynett.no> wrote:
>>> On 26/03/2022 17:56, Bart wrote:
>>>> This is the kind of thing I'm talking about:
>>>>
>>>>     void (*)(void)
>>>>     void (**)(void)
>>>>     void (***)(void)
>>>>     void *(*)(void)
>>>>     void **(*)(void)
>>>>
>>>
>>> I see your first problem. Who on earth needs types like these ones?
>>> The first one, yes, but none of the others.
>>
>> The second one could be the pointer to the element of an array,
>> which is of function pointers. This is reasonably common.
>>
>> for (void (**iter)(void) = initfun_table; *iter; iter++)
>> (**iter)();
>>
>> // (*iter)() would work, but if we have multiple stars going on
>> // might as well match decl and use.
>>
>
> Of course it is always possible to find use-cases for any of these - and
> the less complex, the more common. But nothing (other than knee-jerk
> prejudice) hinders a programmer from using typedefs here if it makes the
> code simpler and clearer (noting that styles and preferences vary
> considerably). So I'd have something like:
>
> enum { len_initfun_table = 10 };
> typedef void (*FInitFunc)(void);
>
> FInitFunc initfun_table[len_initfun_table];
>
> void init_all(void)
> {
> for (int i = 0; i < len_initfun_table; i++) {
> initfun_table[i]();
> }
> }
>
> I prefer array syntax for arrays. I prefer named types to complex ones.
> Of course other people may prefer to write code in different ways (and
> the "best" way to write it can depend on other parts of the code outside
> these snippets, such as how the "init" functions are assigned).

Another thing the swings the balance to me in favour not hiding that
pointer in the typedef is that the same typedef can be used to declare
the functions that go in the table:

typedef void InitFunc(void);

InitFunc allocateSpace, createObjects, setupTimers;

InitFunc *initfun_table[len_initfun_table] = {
allocateSpace,
createObjects,
setupTimers
};

The array of pointers syntax (T *array[]) is so common, that * hardly
matters.

--
Ben.

Re: C isn't a programming language

<t1snoc$bvm$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 28 Mar 2022 18:28:59 +0200
Organization: A noiseless patient Spider
Lines: 75
Message-ID: <t1snoc$bvm$1@dont-email.me>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<t1pc4o$79c$1@dont-email.me> <20220328011524.8@kylheku.com>
<t1sfcd$41u$1@dont-email.me> <874k3iywh8.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 28 Mar 2022 16:29:00 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0303aa88abeb82fa97faf73dd319b0f1";
logging-data="12278"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+21XiHkdax/dn20TLwiWPuPovUGy6404M="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:GeCnsBz7TAA3AJTHFsluM1EjrXI=
In-Reply-To: <874k3iywh8.fsf@bsb.me.uk>
Content-Language: en-GB
 by: David Brown - Mon, 28 Mar 2022 16:28 UTC

On 28/03/2022 16:37, Ben Bacarisse wrote:
> David Brown <david.brown@hesbynett.no> writes:
>
>> On 28/03/2022 10:23, Kaz Kylheku wrote:
>>> On 2022-03-27, David Brown <david.brown@hesbynett.no> wrote:
>>>> On 26/03/2022 17:56, Bart wrote:
>>>>> This is the kind of thing I'm talking about:
>>>>>
>>>>>     void (*)(void)
>>>>>     void (**)(void)
>>>>>     void (***)(void)
>>>>>     void *(*)(void)
>>>>>     void **(*)(void)
>>>>>
>>>>
>>>> I see your first problem. Who on earth needs types like these ones?
>>>> The first one, yes, but none of the others.
>>>
>>> The second one could be the pointer to the element of an array,
>>> which is of function pointers. This is reasonably common.
>>>
>>> for (void (**iter)(void) = initfun_table; *iter; iter++)
>>> (**iter)();
>>>
>>> // (*iter)() would work, but if we have multiple stars going on
>>> // might as well match decl and use.
>>>
>>
>> Of course it is always possible to find use-cases for any of these - and
>> the less complex, the more common. But nothing (other than knee-jerk
>> prejudice) hinders a programmer from using typedefs here if it makes the
>> code simpler and clearer (noting that styles and preferences vary
>> considerably). So I'd have something like:
>>
>> enum { len_initfun_table = 10 };
>> typedef void (*FInitFunc)(void);
>>
>> FInitFunc initfun_table[len_initfun_table];
>>
>> void init_all(void)
>> {
>> for (int i = 0; i < len_initfun_table; i++) {
>> initfun_table[i]();
>> }
>> }
>>
>> I prefer array syntax for arrays. I prefer named types to complex ones.
>> Of course other people may prefer to write code in different ways (and
>> the "best" way to write it can depend on other parts of the code outside
>> these snippets, such as how the "init" functions are assigned).
>
> Another thing the swings the balance to me in favour not hiding that
> pointer in the typedef is that the same typedef can be used to declare
> the functions that go in the table:
>
> typedef void InitFunc(void);
>
> InitFunc allocateSpace, createObjects, setupTimers;
>
> InitFunc *initfun_table[len_initfun_table] = {
> allocateSpace,
> createObjects,
> setupTimers
> };
>
> The array of pointers syntax (T *array[]) is so common, that * hardly
> matters.
>

I don't often have pointers in typedefs when they are data pointers, but
I usually find it convenient for function pointers. There is no one
universal best choice here - there are many variables. For one thing,
in the kind of C programming I do most, there are a lot fewer pointers
than in "average" C programming. Usually there is no dynamic memory of
any kind, and function pointers are rare.

Re: C isn't a programming language

<20220328094411.631@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 28 Mar 2022 16:53:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <20220328094411.631@kylheku.com>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<t1pc4o$79c$1@dont-email.me> <20220328011524.8@kylheku.com>
<t1sfcd$41u$1@dont-email.me> <874k3iywh8.fsf@bsb.me.uk>
Injection-Date: Mon, 28 Mar 2022 16:53:49 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="9f3df9d3c5d46b28e70404db37378c66";
logging-data="19410"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JUN3ie/HX5SAmz5AikMjTbdBOvbzYRbM="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:mAwyqcdbf7RfaDyRVWp+LOpfLHE=
 by: Kaz Kylheku - Mon, 28 Mar 2022 16:53 UTC

On 2022-03-28, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> Another thing the swings the balance to me in favour not hiding that
> pointer in the typedef is that the same typedef can be used to declare
> the functions that go in the table:
>
> typedef void InitFunc(void);
>
> InitFunc allocateSpace, createObjects, setupTimers;

> InitFunc *initfun_table[len_initfun_table] = {
> allocateSpace,
> createObjects,
> setupTimers
> };

If the definitions of these functions were in one file, we could
structure it so no forward declarations are required at all.

If the definitions of the functions are elsewhere, we should
be including a header to get them declared.

If those functions are in a module which is aware of the initfun_table
indirection, it's plausible that the header might have this
declaration:

InitFunc allocateSpace, createObjects, setupTimers;

However, the function definitions cannot use this approach.

Still, it can cut down some of the work if an argument is added
to InitFunc. The definitions have to be edited, but at least the
declarations don't have to be touched if they are in the above form.

There could be a compile-time performance benefit. It's almost
certainly way faster for a compiler to process

InitFunc allocateSpace

than to parse a function declaration that gives arguments, and construct
the type object from all that syntax tree material. Here, all it has to
do is look up InitFunc in a symbol table, and bind the allocateSpace
symbol to that type. There is no new type object to construct. I'd be
surprised if it didn't save compile-time memory.

Say we had a million functions to declare :) which all have the same
return type and signature; this would be the way to go, to reduce
the source file size and processing time.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: C isn't a programming language

<4aebd72c-aa93-4ee9-9271-3ec5731dc227n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:593:b0:2e1:eabd:5e25 with SMTP id c19-20020a05622a059300b002e1eabd5e25mr22707904qtb.191.1648486465608;
Mon, 28 Mar 2022 09:54:25 -0700 (PDT)
X-Received: by 2002:ad4:5949:0:b0:441:8296:a12d with SMTP id
eo9-20020ad45949000000b004418296a12dmr15506637qvb.4.1648486465372; Mon, 28
Mar 2022 09:54:25 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 28 Mar 2022 09:54:24 -0700 (PDT)
In-Reply-To: <t1snoc$bvm$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:99ce:d2d8:c3d3:1385;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:99ce:d2d8:c3d3:1385
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <t1is1k$74g$1@dont-email.me>
<t1l10h$1ts6$1@gioia.aioe.org> <t1l4f7$4tb$1@dont-email.me>
<t1ne04$14rb$1@gioia.aioe.org> <t1ngjs$82m$1@dont-email.me>
<t1pc4o$79c$1@dont-email.me> <20220328011524.8@kylheku.com>
<t1sfcd$41u$1@dont-email.me> <874k3iywh8.fsf@bsb.me.uk> <t1snoc$bvm$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4aebd72c-aa93-4ee9-9271-3ec5731dc227n@googlegroups.com>
Subject: Re: C isn't a programming language
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 28 Mar 2022 16:54:25 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 80
 by: Malcolm McLean - Mon, 28 Mar 2022 16:54 UTC

On Monday, 28 March 2022 at 17:29:13 UTC+1, David Brown wrote:
> On 28/03/2022 16:37, Ben Bacarisse wrote:
> > David Brown <david...@hesbynett.no> writes:
> >
> >> On 28/03/2022 10:23, Kaz Kylheku wrote:
> >>> On 2022-03-27, David Brown <david...@hesbynett.no> wrote:
> >>>> On 26/03/2022 17:56, Bart wrote:
> >>>>> This is the kind of thing I'm talking about:
> >>>>>
> >>>>> void (*)(void)
> >>>>> void (**)(void)
> >>>>> void (***)(void)
> >>>>> void *(*)(void)
> >>>>> void **(*)(void)
> >>>>>
> >>>>
> >>>> I see your first problem. Who on earth needs types like these ones?
> >>>> The first one, yes, but none of the others.
> >>>
> >>> The second one could be the pointer to the element of an array,
> >>> which is of function pointers. This is reasonably common.
> >>>
> >>> for (void (**iter)(void) = initfun_table; *iter; iter++)
> >>> (**iter)();
> >>>
> >>> // (*iter)() would work, but if we have multiple stars going on
> >>> // might as well match decl and use.
> >>>
> >>
> >> Of course it is always possible to find use-cases for any of these - and
> >> the less complex, the more common. But nothing (other than knee-jerk
> >> prejudice) hinders a programmer from using typedefs here if it makes the
> >> code simpler and clearer (noting that styles and preferences vary
> >> considerably). So I'd have something like:
> >>
> >> enum { len_initfun_table = 10 };
> >> typedef void (*FInitFunc)(void);
> >>
> >> FInitFunc initfun_table[len_initfun_table];
> >>
> >> void init_all(void)
> >> {
> >> for (int i = 0; i < len_initfun_table; i++) {
> >> initfun_table[i]();
> >> }
> >> }
> >>
> >> I prefer array syntax for arrays. I prefer named types to complex ones.
> >> Of course other people may prefer to write code in different ways (and
> >> the "best" way to write it can depend on other parts of the code outside
> >> these snippets, such as how the "init" functions are assigned).
> >
> > Another thing the swings the balance to me in favour not hiding that
> > pointer in the typedef is that the same typedef can be used to declare
> > the functions that go in the table:
> >
> > typedef void InitFunc(void);
> >
> > InitFunc allocateSpace, createObjects, setupTimers;
> >
> > InitFunc *initfun_table[len_initfun_table] = {
> > allocateSpace,
> > createObjects,
> > setupTimers
> > };
> >
> > The array of pointers syntax (T *array[]) is so common, that * hardly
> > matters.
> >
> I don't often have pointers in typedefs when they are data pointers, but
> I usually find it convenient for function pointers. There is no one
> universal best choice here - there are many variables. For one thing,
> in the kind of C programming I do most, there are a lot fewer pointers
> than in "average" C programming. Usually there is no dynamic memory of
> any kind, and function pointers are rare.
>
I just wrore a JSON parser for Crossword Designer. JSON consists of objects
embeeded in objects, so it's natural to have a hierarcy of sub-parsers.
However the sub-parsers are really just two integers over the JSON tokens,
giving start and end points of the object. However I allocated them dynamically
to keep the interface neat. (It would be faster to fill in an automatic structure).

Re: C isn't a programming language

<586443cb-257b-46a0-b216-c8c4d0909879n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:24f:b0:2e1:d658:a595 with SMTP id c15-20020a05622a024f00b002e1d658a595mr23263717qtx.657.1648496147717;
Mon, 28 Mar 2022 12:35:47 -0700 (PDT)
X-Received: by 2002:a05:6214:20e6:b0:440:f6d0:fe55 with SMTP id
6-20020a05621420e600b00440f6d0fe55mr23045589qvk.57.1648496147483; Mon, 28 Mar
2022 12:35:47 -0700 (PDT)
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 28 Mar 2022 12:35:47 -0700 (PDT)
In-Reply-To: <t1i34t$m94$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.201; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.201
References: <t1i34t$m94$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <586443cb-257b-46a0-b216-c8c4d0909879n@googlegroups.com>
Subject: Re: C isn't a programming language
From: profesor...@gmail.com (fir)
Injection-Date: Mon, 28 Mar 2022 19:35:47 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 15
 by: fir - Mon, 28 Mar 2022 19:35 UTC

czwartek, 24 marca 2022 o 16:36:11 UTC+1 Richard Harnden napisał(a):
> "C: Everyone's favourite programming language isn't a programming language"
>
> Erm ... <https://www.theregister.com/2022/03/23/c_not_a_language>

as i said last time i was here c is not a programming language, c is a language form

(this is becouse a language need a fixed 'words' (word that have fixed meaning...in
c as it is you dont have that fixed meaning words (which here are functions) you have
onlu a form to build them up ..if you will fix them the result will be language)

Re: C isn't a programming language

<t1td3p$1618$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!aioe.org!NZ87pNe1TKxNDknVl4tZhw.user.46.165.242.91.POSTED!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 28 Mar 2022 22:33:29 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t1td3p$1618$1@gioia.aioe.org>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad> <t1ibau$mtp$1@gioia.aioe.org> <87zglfyz85.fsf@nosuchdomain.example.com> <t1mtp0$1pv4$1@gioia.aioe.org> <t1nq04$hrv$1@gioia.aioe.org> <t1o6qn$1eub$1@gioia.aioe.org> <t1oms4$556$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="38952"; posting-host="NZ87pNe1TKxNDknVl4tZhw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: tin/2.4.5-20201224 ("Glen Albyn") (Linux/5.10.0-9-amd64 (x86_64))
Cancel-Lock: sha1:Z6Z/l/Uw9TxmIggPkA7hAERs/wg=
X-Notice: Filtered by postfilter v. 0.9.2
 by: antis...@math.uni.wroc.pl - Mon, 28 Mar 2022 22:33 UTC

Guillaume <message@bottle.org> wrote:
> Le 27/03/2022 ? 00:15, antispam@math.uni.wroc.pl a ?crit?:
> > There is nothing syntactic in types. Language may decide to clearly
> > separate types from rest of syntax, many do so but C is in the camp
> > that does not make such distintion.
>
> Uh. What are you on about? Yes, knowing what part is a type and what
> part is a variable identifier (for instance) in an expression *is* a
> syntax matter. Just like knowing what is a verb and what is a subject,
> etc, is a syntax matter in natural languages. What camp are you talking
> about?

One language that I use syntactially allows the following two lines:

a : f(2*x + b)
a := f(2*x + b)

First says that variable 'a' has type 'f(2*x + b)'. Second assigns
to 'a' value 'f(2*x + b)'. Semantically, first line is wrong
if 'f(2*x + b)' does not produce a type. The second one is
subject to normal typechecking rules which usually exlude types
(but you may assign types to variables if variable is declared
to hold types). Difference is semanctic, given only 'f(2*x + b)'
you can not decide if it produces a type or not. You need
declaration of 'f' to know (and object code is quite different).

In GNU Pascal

a[b, c, d]

may mean the following:

access element of array 'a'
build array of type 'a' with elements 'b', 'c' and 'd'
build record of type 'a' with field 'b', 'c' and 'd'
build set of type 'a' with elements 'b', 'c' and 'd'

In the first case 'a' must be a variable (normal expression),
in 3 other cases 'a' must be name of type.

> As the earlier, simple and telling example showed:
>
> x y;
>
> You absolutely can't make any syntactic sense of this unless you know
> what x and y are.

You probably meant different example. AFAICS this one can only
be a declaration.

> Without a symbol table, the output of your parser with the above will
> just be a list of tokens, so such a parser essentially becomes a
> tokenizer only.

As I wrote, parser produces trees. With trivial input like 'x y;'
corresponding tree is indeed trivial. For more interesting input
you will get more interesting tree. Of course, exact tree depends
on design of your system. For example, resonable choice for

x y, z;

is to put comma at top of the tree and 'x y' as left subtree, 'z' as
right leaf.

--
Waldek Hebisch

Re: C isn't a programming language

<20220328155324.194@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 28 Mar 2022 22:57:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <20220328155324.194@kylheku.com>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad>
<t1ibau$mtp$1@gioia.aioe.org> <87zglfyz85.fsf@nosuchdomain.example.com>
<t1mtp0$1pv4$1@gioia.aioe.org> <t1nq04$hrv$1@gioia.aioe.org>
<t1o6qn$1eub$1@gioia.aioe.org> <t1oms4$556$1@gioia.aioe.org>
<t1td3p$1618$1@gioia.aioe.org>
Injection-Date: Mon, 28 Mar 2022 22:57:19 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4e6a162cfd562490aabeac8279871962";
logging-data="4327"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19LIEgxGYZv1WDZysFhhOW6psaKWYrVMtc="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:lmcZ1Xnsh6rz57s3erHbwcCBSPA=
 by: Kaz Kylheku - Mon, 28 Mar 2022 22:57 UTC

On 2022-03-28, antispam@math.uni.wroc.pl <antispam@math.uni.wroc.pl> wrote:
> Guillaume <message@bottle.org> wrote:
>> Le 27/03/2022 ? 00:15, antispam@math.uni.wroc.pl a ?crit?:
>> > There is nothing syntactic in types. Language may decide to clearly
>> > separate types from rest of syntax, many do so but C is in the camp
>> > that does not make such distintion.
>>
>> Uh. What are you on about? Yes, knowing what part is a type and what
>> part is a variable identifier (for instance) in an expression *is* a
>> syntax matter. Just like knowing what is a verb and what is a subject,
>> etc, is a syntax matter in natural languages. What camp are you talking
>> about?
>
> One language that I use syntactially allows the following two lines:
>
> a : f(2*x + b)
> a := f(2*x + b)

You can do that in the GNU dialect of C:

typeof (f(2*x + b)) a = f(2*x + b);

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: C isn't a programming language

<864k2h6o3u.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 25 Apr 2022 10:59:17 -0700
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <864k2h6o3u.fsf@linuxsc.com>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad> <t1ibau$mtp$1@gioia.aioe.org> <87zglfyz85.fsf@nosuchdomain.example.com> <t1mtp0$1pv4$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="2b2bd3060d7fb14ae545fc6b32585799";
logging-data="20117"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2Ig9yEsJ2gJ1V90TVUcPPy10+d8Wwb+Y="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:yJ3j7i4Vkj6mjriWU4jzx//p35E=
sha1:9qPDi0Z5T4iQpWs4iNtCCGfEm2I=
 by: Tim Rentsch - Mon, 25 Apr 2022 17:59 UTC

antispam@math.uni.wroc.pl writes:

> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>
>> Guillaume <message@bottle.org> writes:
>>
>>> Le 24/03/2022 ? 16:45, Scott Lurndal a ?crit?:
>>>
>>>> Richard Harnden <richard.nospam@gmail.com> writes:
>>>>
>>>>> "C: Everyone's favourite programming language isn't a
>>>>> programming language"
>>>>>
>>>>> Erm ... <https://www.theregister.com/2022/03/23/c_not_a_language>
>>>>
>>>> The article doesn't make a whole lot of sense - it's basically
>>>> just bitching because swift and rust can't do everything that C
>>>> can.
>>>
>>> And you're putting it lightly.

>>> Of course, first thing, without even reading it, is questioning
>>> the relevance of such articles written by heavy proponents of
>>> "alternative" languages. How much more biased can one be?
>>>
>>> Digging a bit deeper, there is nothing much to even take from this
>>> short article. It's pretty shallow.
>>>
>>> - C is difficult to parse? C declarations are, for instance, not
>>> exactly easy, but it's only very moderately difficult. You can
>>> have fun with this to get an idea: https://cdecl.org/ . I has
>>> never made it a problem to write a C compiler. There are more of
>>> them out there than for any other language, I think. OTOH, there
>>> is, AFAIK, only one implementation of Rust. Which to me is in
>>> itself a problem. I'm curious to see if it ever even gets to the
>>> point of having other competing implementations.
>>
>> It's probably referring to the typedef issue.
>>
>> In the absence of typedefs, type names consist of keywords and
>> punctuation. A typedef (a feature that was added to the language
>> after the syntax had been established) creates a type name that's
>> an identifier. It's impossible to parse something that uses a
>> typedef name without knowing that it's a typedef name. In effect a
>> typedef adds a context-sensitive keyword to the grammar. The
>> parser needs to query the symbol table.
>
> Using symbol table is just one of possible solutions. Another
> one is to note that true ambiguities are really semantic, so
> parser can return tree faithful to all possible meaning. For
> example, cast versus function call is semantic problem so
> parser can return 'call_or_cast' and let semantic phase
> to decide.

Right. Context-free-style parsing is not limited to LR(k)
parsers.

Re: C isn't a programming language

<86zgk959a4.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C isn't a programming language
Date: Mon, 25 Apr 2022 11:04:51 -0700
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <86zgk959a4.fsf@linuxsc.com>
References: <t1i34t$m94$1@dont-email.me> <7m0%J.469671$oF2.277206@fx10.iad> <t1ibau$mtp$1@gioia.aioe.org> <87zglfyz85.fsf@nosuchdomain.example.com> <t1mtp0$1pv4$1@gioia.aioe.org> <t1nq04$hrv$1@gioia.aioe.org> <t1o6qn$1eub$1@gioia.aioe.org> <t1oms4$556$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="2b2bd3060d7fb14ae545fc6b32585799";
logging-data="20117"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zGHdGKjUY6sP8cikmXwK2Lbyzaq99vug="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:iOKnXLzWcQoOLDvWnOXN7pssxME=
sha1:VqhZvDBtjvNf3ej3mjXDr8YCUaM=
 by: Tim Rentsch - Mon, 25 Apr 2022 18:04 UTC

Guillaume <message@bottle.org> writes:

> Le 27/03/2022 at 00:15, antispam@math.uni.wroc.pl a ecrit:
>
>> There is nothing syntactic in types. Language may decide to clearly
>> separate types from rest of syntax, many do so but C is in the camp
>> that does not make such distintion.
>
> Uh. What are you on about? Yes, knowing what part is a type and what
> part is a variable identifier (for instance) in an expression *is* a
> syntax matter. Just like knowing what is a verb and what is a subject,
> etc, is a syntax matter in natural languages. What camp are you
> talking about?
>
> As the earlier, simple and telling example showed:
>
> x y;
>
> You absolutely can't make any syntactic sense of this unless you know
> what x and y are.
>
> Without a symbol table, the output of your parser with the above will
> just be a list of tokens, so such a parser essentially becomes a
> tokenizer only.

I think you are making assumptions about how the parser will be
structured to reach this conclusion. It is quite possible to
structure a parser that can accommodate any context free language,
including those that have ambiguities, and which produce a much
richer output structure than just a stream of tokens.

Pages:123
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor