Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

try again


devel / comp.lang.c / Enum Generators

SubjectAuthor
* Enum GeneratorsRobert Finch
`* Re: Enum GeneratorsDavid Brown
 `* Re: Enum GeneratorsRobert Finch
  `* Re: Enum GeneratorsDavid Brown
   +- Re: Enum GeneratorsRobert Finch
   `- Re: Enum GeneratorsBart

1
Enum Generators

<5af17f7a-262f-4f64-8125-0414b9e027b0n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:ba06:: with SMTP id k6mr6827649qkf.312.1633037216675;
Thu, 30 Sep 2021 14:26:56 -0700 (PDT)
X-Received: by 2002:a05:622a:1652:: with SMTP id y18mr9317614qtj.226.1633037216530;
Thu, 30 Sep 2021 14:26:56 -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: Thu, 30 Sep 2021 14:26:56 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2607:fea8:1de5:5800:8d89:f083:fb69:cbb4;
posting-account=QId4bgoAAABV4s50talpu-qMcPp519Eb
NNTP-Posting-Host: 2607:fea8:1de5:5800:8d89:f083:fb69:cbb4
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5af17f7a-262f-4f64-8125-0414b9e027b0n@googlegroups.com>
Subject: Enum Generators
From: robfi...@gmail.com (Robert Finch)
Injection-Date: Thu, 30 Sep 2021 21:26:56 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 22
 by: Robert Finch - Thu, 30 Sep 2021 21:26 UTC

For my compiler, I added syntax to enums to allow using an enum to define one-hot values. This allows the use of the BBS/BBC instruction by the compiler in some cases.

The syntax is to place the generator expression in round brackets after the enum keyword. Without the generator expression an expression of (1) is assumed. This should not break any existing source code.

Some examples:
1)
enum (-1) { a, b, c, d, e };

Generates the values 0, -1, -2, -3, -4 for a,b,c,d,e respectively.

2)
enum (3) { a, b, c, d, e};
Generates the values 0, 3, 6, 9, 12 for a,b,c,d,e respectively.

3)
enum (2*) { a, b, c, d, e};

Generates the values 0,1,2,4,8 to a,b,c,d,e respectively.
The (2*) is the multiplicative increment spec. (3*, 4*, etc is also possible).

4)
enum (2*) { a = 3, b, c, d, e};
Generates the values 3, 6, 12, 24, and 48 for a, b, c, d, e.

Re: Enum Generators

<sj6dt8$kq5$1@dont-email.me>

  copy mid

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

  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: Enum Generators
Date: Fri, 1 Oct 2021 09:38:16 +0200
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <sj6dt8$kq5$1@dont-email.me>
References: <5af17f7a-262f-4f64-8125-0414b9e027b0n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Oct 2021 07:38:16 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b5f0ab6d56179f9e01a087c9f2a3444a";
logging-data="21317"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/EqZStTOMQwWu7Bjs077TFOKh/VQoXfXs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:RPkIwLzH0eb4/0VX9OvPMVvhuGk=
In-Reply-To: <5af17f7a-262f-4f64-8125-0414b9e027b0n@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Fri, 1 Oct 2021 07:38 UTC

On 30/09/2021 23:26, Robert Finch wrote:
> For my compiler, I added syntax to enums to allow using an enum to define one-hot values. This allows the use of the BBS/BBC instruction by the compiler in some cases.
>
> The syntax is to place the generator expression in round brackets after the enum keyword. Without the generator expression an expression of (1) is assumed. This should not break any existing source code.
>
> Some examples:
> 1)
> enum (-1) { a, b, c, d, e };
>
> Generates the values 0, -1, -2, -3, -4 for a,b,c,d,e respectively.
>
> 2)
> enum (3) { a, b, c, d, e};
> Generates the values 0, 3, 6, 9, 12 for a,b,c,d,e respectively.
>
> 3)
> enum (2*) { a, b, c, d, e};
>
> Generates the values 0,1,2,4,8 to a,b,c,d,e respectively.
> The (2*) is the multiplicative increment spec. (3*, 4*, etc is also possible).
>
> 4)
> enum (2*) { a = 3, b, c, d, e};
> Generates the values 3, 6, 12, 24, and 48 for a, b, c, d, e.
>

What would be the use-cases for these? Real one-hot enumerations
(0b001, 0b0010, 0b0100, 0b1000, etc.) are sometimes useful in
programmable logic since they can be handled quickly in hardware. But
any kind of C to VHDL or other tool for writing programmable logic in C
already has dozens of extensions to handle that kind of thing (if it
can't do it automatically).

What processor(s) are you targeting where you can get measurably more
efficient code from any of these cases? Even for a proper one-hot
enumeration - "enum (2*) { a = 1, b, c, d, e };" in your syntax, and
missing from your examples - and even with the equivalent of a "default
: __builtin_unreachable();" default clause, I have trouble imagining how
it would lead to any improvement.

Alternatively, where do you imagine such syntaxes being useful to the
programmer?

Adding new syntaxes and extensions to a language is not cost-free, even
if it is easy to implement in the tool. It means you have to document
and support steadily more obscure features just in case someone used it
in code in the past, even if no one remembers what it means now.

(It's your language, your tool, and your decision - I'm just pushing you
to think it through.)

Re: Enum Generators

<0b15e260-5394-4483-9b65-26855c09af3en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a0c:c2c4:: with SMTP id c4mr10928124qvi.30.1633100790048;
Fri, 01 Oct 2021 08:06:30 -0700 (PDT)
X-Received: by 2002:ac8:7e86:: with SMTP id w6mr13230864qtj.277.1633100789803;
Fri, 01 Oct 2021 08:06:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!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: Fri, 1 Oct 2021 08:06:29 -0700 (PDT)
In-Reply-To: <sj6dt8$kq5$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2607:fea8:1de5:5800:8d89:f083:fb69:cbb4;
posting-account=QId4bgoAAABV4s50talpu-qMcPp519Eb
NNTP-Posting-Host: 2607:fea8:1de5:5800:8d89:f083:fb69:cbb4
References: <5af17f7a-262f-4f64-8125-0414b9e027b0n@googlegroups.com> <sj6dt8$kq5$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0b15e260-5394-4483-9b65-26855c09af3en@googlegroups.com>
Subject: Re: Enum Generators
From: robfi...@gmail.com (Robert Finch)
Injection-Date: Fri, 01 Oct 2021 15:06:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 89
 by: Robert Finch - Fri, 1 Oct 2021 15:06 UTC

On Friday, October 1, 2021 at 3:38:29 AM UTC-4, David Brown wrote:
> On 30/09/2021 23:26, Robert Finch wrote:
> > For my compiler, I added syntax to enums to allow using an enum to define one-hot values. This allows the use of the BBS/BBC instruction by the compiler in some cases.
> >
> > The syntax is to place the generator expression in round brackets after the enum keyword. Without the generator expression an expression of (1) is assumed. This should not break any existing source code.
> >
> > Some examples:
> > 1)
> > enum (-1) { a, b, c, d, e };
> >
> > Generates the values 0, -1, -2, -3, -4 for a,b,c,d,e respectively.
> >
> > 2)
> > enum (3) { a, b, c, d, e};
> > Generates the values 0, 3, 6, 9, 12 for a,b,c,d,e respectively.
> >
> > 3)
> > enum (2*) { a, b, c, d, e};
> >
> > Generates the values 0,1,2,4,8 to a,b,c,d,e respectively.
> > The (2*) is the multiplicative increment spec. (3*, 4*, etc is also possible).
> >
> > 4)
> > enum (2*) { a = 3, b, c, d, e};
> > Generates the values 3, 6, 12, 24, and 48 for a, b, c, d, e.
> >
> What would be the use-cases for these? Real one-hot enumerations
> (0b001, 0b0010, 0b0100, 0b1000, etc.) are sometimes useful in
> programmable logic since they can be handled quickly in hardware. But
> any kind of C to VHDL or other tool for writing programmable logic in C
> already has dozens of extensions to handle that kind of thing (if it
> can't do it automatically).
>
> What processor(s) are you targeting where you can get measurably more
> efficient code from any of these cases? Even for a proper one-hot
> enumeration - "enum (2*) { a = 1, b, c, d, e };" in your syntax, and
> missing from your examples - and even with the equivalent of a "default
> : __builtin_unreachable();" default clause, I have trouble imagining how
> it would lead to any improvement.
>
> Alternatively, where do you imagine such syntaxes being useful to the
> programmer?
>
>
> Adding new syntaxes and extensions to a language is not cost-free, even
> if it is easy to implement in the tool. It means you have to document
> and support steadily more obscure features just in case someone used it
> in code in the past, even if no one remembers what it means now.
>
> (It's your language, your tool, and your decision - I'm just pushing you
> to think it through.)

I thought being able to generate values might be useful for generating series coefficients for polynomials. That would work better if floats could be defined.
I found the syntax useful for defining error message constants less than zero. If the return value is less than zero then it is an error otherwise it is a valid status.

I also found it useful to allow the BBS / BBC instructions to be used. I defined a set of button presses to be 1,2,4,8,16 for each button respectively.. That way if more than one button is pressed at the same time then a code is generated for that case.
BBS/BBC instructions encode the constant directly in the branch instruction.. Otherwise, a compare then a branch instruction is required to test. This is a single instruction versus two instructions for compare then branch. So, it is both faster and shorter. Most architectures do not have a compare-to-immediate and branch instruction. Whether it is measurably different or not IDK.

I made a slight mistake in my previous example. If the generator is multiplicative then the enumeration automatically starts at one. I also changed the syntax to place the ‘*’ before the constant.

Language obscurity is an issue. The way the generator is introduced it is an optional part of the enum that does not have to be present in the code. One does not need to know about it until it is seen in the code. Then one may need to look it up in the manual.

Re: Enum Generators

<sj7f1f$7cm$1@dont-email.me>

  copy mid

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

  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: Enum Generators
Date: Fri, 1 Oct 2021 19:03:42 +0200
Organization: A noiseless patient Spider
Lines: 118
Message-ID: <sj7f1f$7cm$1@dont-email.me>
References: <5af17f7a-262f-4f64-8125-0414b9e027b0n@googlegroups.com>
<sj6dt8$kq5$1@dont-email.me>
<0b15e260-5394-4483-9b65-26855c09af3en@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 1 Oct 2021 17:03:43 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b5f0ab6d56179f9e01a087c9f2a3444a";
logging-data="7574"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vbRe9t8exqJq+Caw8IjdReMAkkzMkS2c="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:+B5nlOL44AVoLNXoIZCQpH+p3mM=
In-Reply-To: <0b15e260-5394-4483-9b65-26855c09af3en@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Fri, 1 Oct 2021 17:03 UTC

On 01/10/2021 17:06, Robert Finch wrote:
> On Friday, October 1, 2021 at 3:38:29 AM UTC-4, David Brown wrote:
>> On 30/09/2021 23:26, Robert Finch wrote:
>>> For my compiler, I added syntax to enums to allow using an enum
>>> to define one-hot values. This allows the use of the BBS/BBC
>>> instruction by the compiler in some cases.
>>>
>>> The syntax is to place the generator expression in round brackets
>>> after the enum keyword. Without the generator expression an
>>> expression of (1) is assumed. This should not break any existing
>>> source code.
>>>
>>> Some examples: 1) enum (-1) { a, b, c, d, e };
>>>
>>> Generates the values 0, -1, -2, -3, -4 for a,b,c,d,e
>>> respectively.
>>>
>>> 2) enum (3) { a, b, c, d, e}; Generates the values 0, 3, 6, 9, 12
>>> for a,b,c,d,e respectively.
>>>
>>> 3) enum (2*) { a, b, c, d, e};
>>>
>>> Generates the values 0,1,2,4,8 to a,b,c,d,e respectively. The
>>> (2*) is the multiplicative increment spec. (3*, 4*, etc is also
>>> possible).
>>>
>>> 4) enum (2*) { a = 3, b, c, d, e}; Generates the values 3, 6, 12,
>>> 24, and 48 for a, b, c, d, e.
>>>
>> What would be the use-cases for these? Real one-hot enumerations
>> (0b001, 0b0010, 0b0100, 0b1000, etc.) are sometimes useful in
>> programmable logic since they can be handled quickly in hardware.
>> But any kind of C to VHDL or other tool for writing programmable
>> logic in C already has dozens of extensions to handle that kind of
>> thing (if it can't do it automatically).
>>
>> What processor(s) are you targeting where you can get measurably
>> more efficient code from any of these cases? Even for a proper
>> one-hot enumeration - "enum (2*) { a = 1, b, c, d, e };" in your
>> syntax, and missing from your examples - and even with the
>> equivalent of a "default : __builtin_unreachable();" default
>> clause, I have trouble imagining how it would lead to any
>> improvement.
>>
>> Alternatively, where do you imagine such syntaxes being useful to
>> the programmer?
>>
>>
>> Adding new syntaxes and extensions to a language is not cost-free,
>> even if it is easy to implement in the tool. It means you have to
>> document and support steadily more obscure features just in case
>> someone used it in code in the past, even if no one remembers what
>> it means now.
>>
>> (It's your language, your tool, and your decision - I'm just
>> pushing you to think it through.)
>
> I thought being able to generate values might be useful for
> generating series coefficients for polynomials. That would work
> better if floats could be defined. I found the syntax useful for
> defining error message constants less than zero. If the return value
> is less than zero then it is an error otherwise it is a valid
> status.
>

These are things you do /once/. You don't make a feature or extension
in a programming language to save a dozen keystrokes in the source code.

> I also found it useful to allow the BBS / BBC instructions to be
> used. I defined a set of button presses to be 1,2,4,8,16 for each
> button respectively. That way if more than one button is pressed at
> the same time then a code is generated for that case. BBS/BBC
> instructions encode the constant directly in the branch instruction.
> Otherwise, a compare then a branch instruction is required to test.
> This is a single instruction versus two instructions for compare then
> branch. So, it is both faster and shorter. Most architectures do not
> have a compare-to-immediate and branch instruction. Whether it is
> measurably different or not IDK.

Again - what is your target architecture?

And note that if you testing just one bit when several might be set, you
are no longer talking about a switch statement.

>
> I made a slight mistake in my previous example. If the generator is
> multiplicative then the enumeration automatically starts at one. I
> also changed the syntax to place the ‘*’ before the constant.
>
> Language obscurity is an issue. The way the generator is introduced
> it is an optional part of the enum that does not have to be present
> in the code. One does not need to know about it until it is seen in
> the code. Then one may need to look it up in the manual.
>

Assume that no one reads the manuals, and assume that features that are
rarely used are incomprehensible and confusing to people using the
language. Like it or not, that is the reality. Ask 1000 experienced C
programmers what "static" or an asterix in an array specifier in a
function declaration means. The number of people who could tell you
could be counted on one hand. The number who have actually /used/ those
language features could probably be counted on one finger. Obscure and
rarely useful features are not a good idea unless they give a serious
and significant benefit that cannot be achieved in more normal and
obvious ways.

There are, or have been, a number of people in this group that have made
or are making their own languages. They are the only people who ever
use the tools, they designed their language(s), they wrote their
tool(s). They made their language according to their own person ideas
of what makes a "perfect" language. And without exception (AFAIK), they
forget details, forget what features they do or do not have, forget how
things work. That's not a criticism of these language creators - it is,
I think, an inevitable consequence of doing the design on their own
without discussing ideas with others, and without the benefit of having
multiple people try out the language in practice.

Re: Enum Generators

<5e0b4b1a-aa15-443a-ab6a-b9bcd509422en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:f902:: with SMTP id l2mr581326qkj.511.1633131364086;
Fri, 01 Oct 2021 16:36:04 -0700 (PDT)
X-Received: by 2002:a37:48c:: with SMTP id 134mr574211qke.233.1633131363944;
Fri, 01 Oct 2021 16:36:03 -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: Fri, 1 Oct 2021 16:36:03 -0700 (PDT)
In-Reply-To: <sj7f1f$7cm$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2607:fea8:1de5:5800:f5ad:a643:bc3c:1941;
posting-account=QId4bgoAAABV4s50talpu-qMcPp519Eb
NNTP-Posting-Host: 2607:fea8:1de5:5800:f5ad:a643:bc3c:1941
References: <5af17f7a-262f-4f64-8125-0414b9e027b0n@googlegroups.com>
<sj6dt8$kq5$1@dont-email.me> <0b15e260-5394-4483-9b65-26855c09af3en@googlegroups.com>
<sj7f1f$7cm$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5e0b4b1a-aa15-443a-ab6a-b9bcd509422en@googlegroups.com>
Subject: Re: Enum Generators
From: robfi...@gmail.com (Robert Finch)
Injection-Date: Fri, 01 Oct 2021 23:36:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 129
 by: Robert Finch - Fri, 1 Oct 2021 23:36 UTC

On Friday, October 1, 2021 at 1:03:55 PM UTC-4, David Brown wrote:
> On 01/10/2021 17:06, Robert Finch wrote:
> > On Friday, October 1, 2021 at 3:38:29 AM UTC-4, David Brown wrote:
> >> On 30/09/2021 23:26, Robert Finch wrote:
> >>> For my compiler, I added syntax to enums to allow using an enum
> >>> to define one-hot values. This allows the use of the BBS/BBC
> >>> instruction by the compiler in some cases.
> >>>
> >>> The syntax is to place the generator expression in round brackets
> >>> after the enum keyword. Without the generator expression an
> >>> expression of (1) is assumed. This should not break any existing
> >>> source code.
> >>>
> >>> Some examples: 1) enum (-1) { a, b, c, d, e };
> >>>
> >>> Generates the values 0, -1, -2, -3, -4 for a,b,c,d,e
> >>> respectively.
> >>>
> >>> 2) enum (3) { a, b, c, d, e}; Generates the values 0, 3, 6, 9, 12
> >>> for a,b,c,d,e respectively.
> >>>
> >>> 3) enum (2*) { a, b, c, d, e};
> >>>
> >>> Generates the values 0,1,2,4,8 to a,b,c,d,e respectively. The
> >>> (2*) is the multiplicative increment spec. (3*, 4*, etc is also
> >>> possible).
> >>>
> >>> 4) enum (2*) { a = 3, b, c, d, e}; Generates the values 3, 6, 12,
> >>> 24, and 48 for a, b, c, d, e.
> >>>
> >> What would be the use-cases for these? Real one-hot enumerations
> >> (0b001, 0b0010, 0b0100, 0b1000, etc.) are sometimes useful in
> >> programmable logic since they can be handled quickly in hardware.
> >> But any kind of C to VHDL or other tool for writing programmable
> >> logic in C already has dozens of extensions to handle that kind of
> >> thing (if it can't do it automatically).
> >>
> >> What processor(s) are you targeting where you can get measurably
> >> more efficient code from any of these cases? Even for a proper
> >> one-hot enumeration - "enum (2*) { a = 1, b, c, d, e };" in your
> >> syntax, and missing from your examples - and even with the
> >> equivalent of a "default : __builtin_unreachable();" default
> >> clause, I have trouble imagining how it would lead to any
> >> improvement.
> >>
> >> Alternatively, where do you imagine such syntaxes being useful to
> >> the programmer?
> >>
> >>
> >> Adding new syntaxes and extensions to a language is not cost-free,
> >> even if it is easy to implement in the tool. It means you have to
> >> document and support steadily more obscure features just in case
> >> someone used it in code in the past, even if no one remembers what
> >> it means now.
> >>
> >> (It's your language, your tool, and your decision - I'm just
> >> pushing you to think it through.)
> >
> > I thought being able to generate values might be useful for
> > generating series coefficients for polynomials. That would work
> > better if floats could be defined. I found the syntax useful for
> > defining error message constants less than zero. If the return value
> > is less than zero then it is an error otherwise it is a valid
> > status.
> >
> These are things you do /once/. You don't make a feature or extension
> in a programming language to save a dozen keystrokes in the source code.
> > I also found it useful to allow the BBS / BBC instructions to be
> > used. I defined a set of button presses to be 1,2,4,8,16 for each
> > button respectively. That way if more than one button is pressed at
> > the same time then a code is generated for that case. BBS/BBC
> > instructions encode the constant directly in the branch instruction.
> > Otherwise, a compare then a branch instruction is required to test.
> > This is a single instruction versus two instructions for compare then
> > branch. So, it is both faster and shorter. Most architectures do not
> > have a compare-to-immediate and branch instruction. Whether it is
> > measurably different or not IDK.
> Again - what is your target architecture?
>
> And note that if you testing just one bit when several might be set, you
> are no longer talking about a switch statement.
> >
> > I made a slight mistake in my previous example. If the generator is
> > multiplicative then the enumeration automatically starts at one. I
> > also changed the syntax to place the ‘*’ before the constant.
> >
> > Language obscurity is an issue. The way the generator is introduced
> > it is an optional part of the enum that does not have to be present
> > in the code. One does not need to know about it until it is seen in
> > the code. Then one may need to look it up in the manual.
> >
> Assume that no one reads the manuals, and assume that features that are
> rarely used are incomprehensible and confusing to people using the
> language. Like it or not, that is the reality. Ask 1000 experienced C
> programmers what "static" or an asterix in an array specifier in a
> function declaration means. The number of people who could tell you
> could be counted on one hand. The number who have actually /used/ those
> language features could probably be counted on one finger. Obscure and
> rarely useful features are not a good idea unless they give a serious
> and significant benefit that cannot be achieved in more normal and
> obvious ways.
>
> There are, or have been, a number of people in this group that have made
> or are making their own languages. They are the only people who ever
> use the tools, they designed their language(s), they wrote their
> tool(s). They made their language according to their own person ideas
> of what makes a "perfect" language. And without exception (AFAIK), they
> forget details, forget what features they do or do not have, forget how
> things work. That's not a criticism of these language creators - it is,
> I think, an inevitable consequence of doing the design on their own
> without discussing ideas with others, and without the benefit of having
> multiple people try out the language in practice.

The target architecture is one of several custom designs which include BBS / BBC instructions. Most recently I have been working on ANY1. I have also ported the compiler to generate PowerPC code and RISCV code. The PowerPC version does not yet make use of all processor features like update addressing and the loop counter.

Re: Enum Generators

<sj8929$e41$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Enum Generators
Date: Sat, 2 Oct 2021 01:27:51 +0100
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <sj8929$e41$1@dont-email.me>
References: <5af17f7a-262f-4f64-8125-0414b9e027b0n@googlegroups.com>
<sj6dt8$kq5$1@dont-email.me>
<0b15e260-5394-4483-9b65-26855c09af3en@googlegroups.com>
<sj7f1f$7cm$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 2 Oct 2021 00:27:53 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0a039225d3efdf2ac6e7f9b46a165789";
logging-data="14465"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TAKhFqe7pMAnehivp1tdIrmaTJ18/qdM="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:CWr140By6QJrF8bmq8NlVsU/v14=
In-Reply-To: <sj7f1f$7cm$1@dont-email.me>
X-Antivirus-Status: Clean
Content-Language: en-GB
X-Antivirus: AVG (VPS 211001-4, 1/10/2021), Outbound message
 by: Bart - Sat, 2 Oct 2021 00:27 UTC

On 01/10/2021 18:03, David Brown wrote:
> On 01/10/2021 17:06, Robert Finch wrote:

> There are, or have been, a number of people in this group that have made
> or are making their own languages. They are the only people who ever
> use the tools, they designed their language(s), they wrote their
> tool(s). They made their language according to their own person ideas
> of what makes a "perfect" language.

In my case, development has been driven by specific needs. I was not, at
the time, creating a general purpose language for anyone to use and on
any computer.

It happens that by now, my language can /easily/ do anything C can do,
so if that is general purpose, then so is mine.

And I don't consider my language perfect otherwise I would have stopped
development long ago.

For example, I've had my module system for quite a few years (C++ is
just acquiring one). Long enough to discover its problems. I'm just
about to overhaul it and may even do away with it because I have ideas
for a different, and better, approach.

> And without exception (AFAIK), they
> forget details, forget what features they do or do not have, forget how
> things work.

I can tell you one thing I don't forget: it is how to write a complex
type declaration. That's because there is nothing to remember about it.

> That's not a criticism of these language creators - it is,
> I think, an inevitable consequence of doing the design on their own
> without discussing ideas with others, and without the benefit of having
> multiple people try out the language in practice.

I've used mine on myriad projects over 40 years; you get to see what
works well and what doesn't; what's needed and what isn't; what belongs
in this language, and what is better off in the next language up.

I suspect the feedback from people, who might have been used to a
different language (like C), will be mainly why doesn't it have feature
X, Y and Z from that other language.

Fortunately I don't need to pander to anybody else.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor