Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The nicest thing about the Alto is that it doesn't run faster at night.


devel / comp.arch / Re: Dense machine code from C++ code (compiler optimizations)

SubjectAuthor
* Dense machine code from C++ code (compiler optimizations)Marcus
+* Re: Dense machine code from C++ code (compiler optimizations)Terje Mathisen
|`- Re: Dense machine code from C++ code (compiler optimizations)Marcus
+* Re: Dense machine code from C++ code (compiler optimizations)BGB
|+* Re: Dense machine code from C++ code (compiler optimizations)robf...@gmail.com
||`* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
|| `* Re: Dense machine code from C++ code (compiler optimizations)BGB
||  +- Re: Dense machine code from C++ code (compiler optimizations)Ivan Godard
||  `* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
||   +* Re: Dense machine code from C++ code (compiler optimizations)Ivan Godard
||   |`- Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
||   `* Re: Dense machine code from C++ code (compiler optimizations)BGB
||    `* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
||     `* Re: Dense machine code from C++ code (compiler optimizations)BGB
||      +* Re: Dense machine code from C++ code (compiler optimizations)robf...@gmail.com
||      |+- Re: Dense machine code from C++ code (compiler optimizations)BGB
||      |`* Re: Thor (was: Dense machine code...)Marcus
||      | `* Re: Thor (was: Dense machine code...)robf...@gmail.com
||      |  +- Re: ThorEricP
||      |  `* Re: Thor (was: Dense machine code...)Marcus
||      |   `- Re: Thor (was: Dense machine code...)robf...@gmail.com
||      `* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
||       `* Re: Dense machine code from C++ code (compiler optimizations)BGB
||        `* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
||         `* Re: Dense machine code from C++ code (compiler optimizations)BGB
||          `* Re: Dense machine code from C++ code (compiler optimizations)BGB
||           `* Re: Testing with open source games (was Dense machine code ...)Marcus
||            +* Re: Testing with open source games (was Dense machine code ...)Terje Mathisen
||            |`* Re: Testing with open source games (was Dense machine code ...)Marcus
||            | +- Re: Testing with open source games (was Dense machine code ...)Terje Mathisen
||            | `* Re: Testing with open source games (was Dense machine code ...)James Van Buskirk
||            |  `- Re: Testing with open source games (was Dense machine code ...)Marcus
||            `- Re: Testing with open source games (was Dense machine code ...)BGB
|`* Re: Dense machine code from C++ code (compiler optimizations)Marcus
| +* Re: Dense machine code from C++ code (compiler optimizations)Ivan Godard
| |+- Re: Dense machine code from C++ code (compiler optimizations)Thomas Koenig
| |`* Re: Dense machine code from C++ code (compiler optimizations)BGB
| | `* Re: Dense machine code from C++ code (compiler optimizations)Ivan Godard
| |  +- Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
| |  `- Re: Dense machine code from C++ code (compiler optimizations)BGB
| +* Re: Dense machine code from C++ code (compiler optimizations)BGB
| |`- Re: Dense machine code from C++ code (compiler optimizations)Paul A. Clayton
| `* Re: Dense machine code from C++ code (compiler optimizations)Thomas Koenig
|  `* Re: Dense machine code from C++ code (compiler optimizations)Marcus
|   +* Re: Dense machine code from C++ code (compiler optimizations)Thomas Koenig
|   |`* Re: Dense machine code from C++ code (compiler optimizations)Marcus
|   | `- Re: Dense machine code from C++ code (compiler optimizations)Thomas Koenig
|   `* Re: Dense machine code from C++ code (compiler optimizations)BGB
|    +* Re: Dense machine code from C++ code (compiler optimizations)Marcus
|    |`- Re: Dense machine code from C++ code (compiler optimizations)George Neuner
|    `* Re: Dense machine code from C++ code (compiler optimizations)David Brown
|     `* Re: Dense machine code from C++ code (compiler optimizations)Marcus
|      `* Re: Dense machine code from C++ code (compiler optimizations)Terje Mathisen
|       +* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
|       |`- Re: Dense machine code from C++ code (compiler optimizations)Terje Mathisen
|       +- Re: Dense machine code from C++ code (compiler optimizations)BGB
|       `- Re: Dense machine code from C++ code (compiler optimizations)Marcus
`* Re: Dense machine code from C++ code (compiler optimizations)Ir. Hj. Othman bin Hj. Ahmad
 +- Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
 `* Re: Dense machine code from C++ code (compiler optimizations)Thomas Koenig
  +* Re: Dense machine code from C++ code (compiler optimizations)chris
  |`* Re: Dense machine code from C++ code (compiler optimizations)David Brown
  | `* Re: Dense machine code from C++ code (compiler optimizations)chris
  |  +* Re: Dense machine code from C++ code (compiler optimizations)David Brown
  |  |`- Re: Dense machine code from C++ code (compiler optimizations)chris
  |  `* Re: Dense machine code from C++ code (compiler optimizations)Terje Mathisen
  |   `* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
  |    +- Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
  |    `* Re: Dense machine code from C++ code (compiler optimizations)Terje Mathisen
  |     `- Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
  +* Re: Dense machine code from C++ code (compiler optimizations)David Brown
  |`* Re: Dense machine code from C++ code (compiler optimizations)BGB
  | `* Re: Dense machine code from C++ code (compiler optimizations)David Brown
  |  `* Re: Dense machine code from C++ code (compiler optimizations)BGB
  |   +* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
  |   |`* Re: Dense machine code from C++ code (compiler optimizations)BGB
  |   | `- Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
  |   `* Re: Dense machine code from C++ code (compiler optimizations)David Brown
  |    `- Re: Dense machine code from C++ code (compiler optimizations)BGB
  `* Re: Dense machine code from C++ code (compiler optimizations)Stephen Fuld
   +* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
   |`- Re: Dense machine code from C++ code (compiler optimizations)Stephen Fuld
   +* Re: Dense machine code from C++ code (compiler optimizations)James Van Buskirk
   |`* Re: Dense machine code from C++ code (compiler optimizations)Stephen Fuld
   | +* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
   | |+- Re: Dense machine code from C++ code (compiler optimizations)Marcus
   | |`* Re: Dense machine code from C++ code (compiler optimizations)Terje Mathisen
   | | `* Re: Dense machine code from C++ code (compiler optimizations)Stephen Fuld
   | |  `* Re: Dense machine code from C++ code (compiler optimizations)EricP
   | |   `* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
   | |    `* Re: Dense machine code from C++ code (compiler optimizations)EricP
   | |     `* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
   | |      `- Re: Dense machine code from C++ code (compiler optimizations)EricP
   | `* Re: Dense machine code from C++ code (compiler optimizations)Tim Rentsch
   |  +* Re: Dense machine code from C++ code (compiler optimizations)Stephen Fuld
   |  |+* Re: Dense machine code from C++ code (compiler optimizations)Guillaume
   |  ||+* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
   |  |||+- Re: Dense machine code from C++ code (compiler optimizations)Thomas Koenig
   |  |||`* Re: Dense machine code from C++ code (compiler optimizations)Guillaume
   |  ||| +* Re: Dense machine code from C++ code (compiler optimizations)MitchAlsup
   |  ||| |`* Re: Dense machine code from C++ code (compiler optimizations)Andreas Eder
   |  ||| `- Re: Dense machine code from C++ code (compiler optimizations)Tim Rentsch
   |  ||`- Re: Dense machine code from C++ code (compiler optimizations)Tim Rentsch
   |  |`* Re: Dense machine code from C++ code (compiler optimizations)Tim Rentsch
   |  `* Re: Dense machine code from C++ code (compiler optimizations)Ivan Godard
   `- Re: Dense machine code from C++ code (compiler optimizations)Andreas Eder

Pages:12345678
Re: Dense machine code from C++ code (compiler optimizations)

<rqqesg12a6pfed4jlupem8ries3rqmngkj@4ax.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22440&group=comp.arch#22440

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: gneun...@comcast.net (George Neuner)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Sat, 25 Dec 2021 14:05:49 -0500
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <rqqesg12a6pfed4jlupem8ries3rqmngkj@4ax.com>
References: <sndun6$q07$1@dont-email.me> <dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com> <sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me> <spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me> <86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me> <sq2hfi$lah$1@gioia.aioe.org> <cc7b7735-d386-4b43-ac97-035c647d7f05n@googlegroups.com> <sq2vkc$qp3$1@gioia.aioe.org> <3773e6bc-7641-4512-a8d5-d3cab2385558n@googlegroups.com> <87bl16gni2.fsf@eder.anydns.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="17d11ff470bd4cbd27690d324c12a379";
logging-data="1190"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uXOz2Y2gp5uDmqtX0UvKynw9cHLC1JxY="
User-Agent: ForteAgent/8.00.32.1272
Cancel-Lock: sha1:gXNr/lAg3t0MqMoQftAEKK8QWa0=
 by: George Neuner - Sat, 25 Dec 2021 19:05 UTC

On Fri, 24 Dec 2021 14:07:17 +0100, Andreas Eder <a_eder_muc@web.de>
wrote:

>On Do 23 Dez 2021 at 16:10, MitchAlsup <MitchAlsup@aol.com> wrote:
>
>> Adding it syntactically into the language would allow the offset and width
>> to be anything in the range of an integer--imagine a bit field 11,357 bits long
>> at offset 1,496 into a 29,000-bit container--and the compiler knows what code
>> to produce. That is: real bit fields.
>> <
>> Perhaps this is a job for C++
>
>Just gave a look into Common Lisp!
>
>'Andreas

+1

Or a modern Scheme.

George

Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)

<d70af98d-4e72-400a-abe9-000146ef3901n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22441&group=comp.arch#22441

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:6214:508a:: with SMTP id kk10mr9917508qvb.52.1640460456885;
Sat, 25 Dec 2021 11:27:36 -0800 (PST)
X-Received: by 2002:a05:6808:2396:: with SMTP id bp22mr8803872oib.78.1640460456630;
Sat, 25 Dec 2021 11:27:36 -0800 (PST)
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.arch
Date: Sat, 25 Dec 2021 11:27:36 -0800 (PST)
In-Reply-To: <sq65vu$pcc$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:65dd:bb7:48b5:b678;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:65dd:bb7:48b5:b678
References: <sndun6$q07$1@dont-email.me> <sq372j$80q$1@dont-email.me>
<sq4l7a$21u$1@newsreader4.netcologne.de> <sq4p88$77q$1@dont-email.me>
<sq5865$1cn9$1@gal.iecc.com> <541dba94-b488-44e5-a939-1557f3ea9709n@googlegroups.com>
<sq5mga$k9o$1@dont-email.me> <sq65vu$pcc$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d70af98d-4e72-400a-abe9-000146ef3901n@googlegroups.com>
Subject: Re: Macros, threat or menace, was Dense machine code from C++ code
(compiler optimizations)
From: already5...@yahoo.com (Michael S)
Injection-Date: Sat, 25 Dec 2021 19:27:36 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 27
 by: Michael S - Sat, 25 Dec 2021 19:27 UTC

On Saturday, December 25, 2021 at 6:17:05 AM UTC+2, Ivan Godard wrote:
> On 12/24/2021 3:52 PM, Bakul Shah wrote:
> > On 12/24/21 1:29 PM, JimBrakefield wrote:
> >> At my current level of understanding:
> >> An interesting feature of Zig is that instead of a macro or
> >> preprocessor the compiler
> >> will execute at compile time anything the can be computed at compile time
> >> (including type expressions). Thus the language itself is it's own
> >> preprocessor.
> >> And like the RTL languages, simplification and reduction is carried as
> >> far as possible.
> >
> > The "V" language also does this. But this is not the same as decent
> > macro processing. Scheme/CL macros allow you to abstract away details
> > very nicely but for that to work, there needs to a language syntax model
> > the macros can access. This is much simpler in S-expr languages since
> > the AST *is* the concrete syntax (more or less)!
> SmallTalk had the execution context accessible and mutable by the
> running program, including during translation. Rarely used but immensely
> powerful. I once did a co-routine system where "visit" severed the call
> stack in the middle and rehooked it to the top of the call stack of the
> visitee.
>
> But second order usage is hard to grok. Unfortunately, reality is second
> order. Probably has to be, or it wouldn't be real. That's an example.

Probably, I have to think about it.
Even more probably, I wouldn't.

Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)

<sq7s5m$13p2$1@gal.iecc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22442&group=comp.arch#22442

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
From: joh...@taugh.com (John Levine)
Newsgroups: comp.arch
Subject: Re: Macros, threat or menace, was Dense machine code from C++ code
(compiler optimizations)
Date: Sat, 25 Dec 2021 19:41:42 -0000 (UTC)
Organization: Taughannock Networks
Message-ID: <sq7s5m$13p2$1@gal.iecc.com>
References: <sndun6$q07$1@dont-email.me> <sq5865$1cn9$1@gal.iecc.com> <b23bb66b-d466-4b2d-be44-ffb2c6dfceeen@googlegroups.com> <sq5hj8$mhh$1@newsreader4.netcologne.de>
Injection-Date: Sat, 25 Dec 2021 19:41:42 -0000 (UTC)
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
logging-data="36642"; mail-complaints-to="abuse@iecc.com"
In-Reply-To: <sndun6$q07$1@dont-email.me> <sq5865$1cn9$1@gal.iecc.com> <b23bb66b-d466-4b2d-be44-ffb2c6dfceeen@googlegroups.com> <sq5hj8$mhh$1@newsreader4.netcologne.de>
Cleverness: some
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: johnl@iecc.com (John Levine)
 by: John Levine - Sat, 25 Dec 2021 19:41 UTC

According to Thomas Koenig <tkoenig@netcologne.de>:
># The PL/C compiler had the unusual capability of never failing
># to compile any program, through the use of extensive automatic
># correction of many syntax errors and by converting any remaining
># syntax errors to output statements.
>
>That sounds dubious to me, errors should be reported (in a useful
>and friendly manner), but auto-correction... DWIM never really
>worked.

Students punched their programs on cards, fed them through the card reader,
and waited, often quite a while, for the printed results. In that environment,
making a guess about what the user intended was better than nothing and could
help reduce the number of runs until the program worked.

--
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)

<sq7uoc$9g1$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22443&group=comp.arch#22443

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-eb03-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Macros, threat or menace, was Dense machine code from C++ code
(compiler optimizations)
Date: Sat, 25 Dec 2021 20:25:49 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <sq7uoc$9g1$1@newsreader4.netcologne.de>
References: <sndun6$q07$1@dont-email.me> <sq5865$1cn9$1@gal.iecc.com>
<b23bb66b-d466-4b2d-be44-ffb2c6dfceeen@googlegroups.com>
<sq5hj8$mhh$1@newsreader4.netcologne.de> <sq7s5m$13p2$1@gal.iecc.com>
Injection-Date: Sat, 25 Dec 2021 20:25:49 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-eb03-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:eb03:0:7285:c2ff:fe6c:992d";
logging-data="9729"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 25 Dec 2021 20:25 UTC

John Levine <johnl@taugh.com> schrieb:
> According to Thomas Koenig <tkoenig@netcologne.de>:
>># The PL/C compiler had the unusual capability of never failing
>># to compile any program, through the use of extensive automatic
>># correction of many syntax errors and by converting any remaining
>># syntax errors to output statements.
>>
>>That sounds dubious to me, errors should be reported (in a useful
>>and friendly manner), but auto-correction... DWIM never really
>>worked.
>
> Students punched their programs on cards, fed them through the card reader,
> and waited, often quite a while, for the printed results. In that environment,
> making a guess about what the user intended was better than nothing and could
> help reduce the number of runs until the program worked.

That sounds reasonable.

These days, it is often more useful to stop after the first error, or
first few errors, to avoid the confusing cascade of subsequent errors.

Second-order programming and Advent of Code

<sq7v1g$15is$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22444&group=comp.arch#22444

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!rd9pRsUZyxkRLAEK7e/Uzw.user.46.165.242.91.POSTED!not-for-mail
From: terje.ma...@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Second-order programming and Advent of Code
Date: Sat, 25 Dec 2021 21:30:43 +0100
Organization: Aioe.org NNTP Server
Message-ID: <sq7v1g$15is$1@gioia.aioe.org>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq372j$80q$1@dont-email.me>
<sq4l7a$21u$1@newsreader4.netcologne.de> <sq4p88$77q$1@dont-email.me>
<2021Dec25.172653@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="38492"; posting-host="rd9pRsUZyxkRLAEK7e/Uzw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101
Firefox/68.0 SeaMonkey/2.53.10.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: Terje Mathisen - Sat, 25 Dec 2021 20:30 UTC

Second-order programming was needed (or at least very useful!) for day
24 of this year's Advent of Code (https://adventofcode.com/2021/day/24)

(From that page:)
The ALU is a four-dimensional processing unit: it has integer variables
w, x, y, and z. These variables all start with the value 0. The ALU also
supports six instructions:

inp a - Read an input value and write it to variable a.
add a b - Add the value of a to the value of b, then store the result in
variable a.
mul a b - Multiply the value of a by the value of b, then store the
result in variable a.
div a b - Divide the value of a by the value of b, truncate the result
to an integer, then store the result in variable a. (Here, "truncate"
means to round the value toward zero.)
mod a b - Divide the value of a by the value of b, then store the
remainder in variable a. (This is also called the modulo operation.)
eql a b - If the value of a and b are equal, then store the value 1 in
variable a. Otherwise, store the value 0 in variable a.
In all of these instructions, a and b are placeholders; a will always be
the variable where the result of the operation is stored (one of w, x,
y, or z), while b can be either a variable or a number. Numbers can be
positive or negative, but will always be integers.

The ALU has no jump instructions; in an ALU program, every instruction
is run exactly once in order from top to bottom. The program halts after
the last instruction has finished executing.
(end quote)

The puzzle was that we were given an (obviously branchless!) program
written for this ALU, it consisted of 14 sections all starting with an
inp() instruction, each of which would consume a single non-zero digit,
and we had to figure out which maximally large 14-digit number would
cause the Z register to end up as Zero.

So I obviously started by writing an interpreter for this very simple
ALU, then for the next stage I added a "cross-compiler", i.e. the
interpreter would output a single statement in my favorite language,
doing the same thing, and I then imported this as a new "fastALU()"
function, totally removing the interpreter overhead.

I still had to spend quite a while figuring out the actual logic
implemented by each of these 14 sections (here's one of them):

inp w
mul x 0
add x z
mod x 26
div z 26
add x -6
eql x w
eql x 0
mul y 0
add y 25
mul y x
add y 1
mul z y
mul y 0
add y w
add y 12
mul y x
add z y

This can (with some effort) be translated into:

w = input_digit();
x = z % 26 - 6;
z /= 26;
if (x != w) {
z = z * 26 + w + 12;
}

Similar but slightly different logic for ech of the sections, crucially
half of them would add 10 or more to x (instead of adding/subtracting a
small value like the -6 above), guaranteeing (x != w), and therefore
always multiplying z by 26!

Closer to the end I realized that I could start with the last section
and work out which combinations of starting w,x,y,z would cause z to be
zero, then use that (quite short list!) as the possible end points for
section 13 etc.

Terje
--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)

<sq88pt$kpo$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22449&group=comp.arch#22449

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bak...@iitbombay.org (Bakul Shah)
Newsgroups: comp.arch
Subject: Re: Macros, threat or menace, was Dense machine code from C++ code
(compiler optimizations)
Date: Sat, 25 Dec 2021 15:17:17 -0800
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <sq88pt$kpo$1@dont-email.me>
References: <sndun6$q07$1@dont-email.me> <sq372j$80q$1@dont-email.me>
<sq4l7a$21u$1@newsreader4.netcologne.de> <sq4p88$77q$1@dont-email.me>
<sq5865$1cn9$1@gal.iecc.com>
<b23bb66b-d466-4b2d-be44-ffb2c6dfceeen@googlegroups.com>
<sq5m82$ich$1@dont-email.me> <8735mh85p8.fsf@eder.anydns.info>
<sq6p1d$8ch$1@dont-email.me> <87r1a07qft.fsf@eder.anydns.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Dec 2021 23:17:17 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1e675b2f54dc6582de2268ae2cc26067";
logging-data="21304"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1821KE3+scTIc8WiW/wsXUu"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:68.0)
Gecko/20100101 Firefox/68.0 SeaMonkey/2.53.10.1
Cancel-Lock: sha1:FX9fdqVQ8TSn9mzrsESfj7TyTRg=
In-Reply-To: <87r1a07qft.fsf@eder.anydns.info>
 by: Bakul Shah - Sat, 25 Dec 2021 23:17 UTC

On 12/25/21 5:40 AM, Andreas Eder wrote:
> On Sa 25 Dez 2021 at 01:42, Bakul Shah <bakul@iitbombay.org> wrote:
>
>> On 12/25/21 12:11 AM, Andreas Eder wrote:
>>> On Fr 24 Dez 2021 at 15:48, Bakul Shah <bakul@iitbombay.org> wrote:
>>>
>>>> The macro languages of Scheme and Common Lisp are quite powerful.
>>> This is true.
>>>
>>>> CL's much more so than Scheme's.
>>> That is not so. Theoretically (and practically) thet are on the same
>>> level, but Scheme has several different macro systems - even a hygienic
>>> one.
>>
>> Note that I am not an expert in this area but everything I
>> have read so far says CL macros are more powerful than
>> Scheme's. Scheme's are *safer* but less powerful. See for
>> instance
>> https://letoverlambda.com/index.cl/guest/chap3.html#sec_4
>> where the author says:
>> Hygienic macros are, in the best of situations, a beginner's
>> safety guard-rail; in the worst of situations they form an
>> electric fence, trapping their victims in a sanitised,
>> capture-safe prison. Furthermore, recent research has shown
>> that hygienic macro systems like those specified by various
>> Scheme revisions can still be vulnerable to many interesting
>> capture problems
>
> The problem with Scheme is, that there are different standards (RxRS for
> x from 5 to 7) but in a scheme that supports syntax-case zou can define
> CL's defmacro and some implementations already have it (maybe under yhe
> name of define-macro).
>
> For more about that topic you should read
> https://stackoverflow.com/questions/19664993/is-it-possible-to-implement-common-lisps-macro-system-in-scheme
>
> That should clarify the point better than I could here.

Can any of the RnRS Schemes do reader macros?

Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)

<87k0fr7lnp.fsf@eder.anydns.info>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22455&group=comp.arch#22455

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: a_eder_...@web.de (Andreas Eder)
Newsgroups: comp.arch
Subject: Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)
Date: Sun, 26 Dec 2021 10:36:26 +0100
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <87k0fr7lnp.fsf@eder.anydns.info>
References: <sndun6$q07$1@dont-email.me> <sq372j$80q$1@dont-email.me>
<sq4l7a$21u$1@newsreader4.netcologne.de> <sq4p88$77q$1@dont-email.me>
<sq5865$1cn9$1@gal.iecc.com>
<b23bb66b-d466-4b2d-be44-ffb2c6dfceeen@googlegroups.com>
<sq5m82$ich$1@dont-email.me> <8735mh85p8.fsf@eder.anydns.info>
<sq6p1d$8ch$1@dont-email.me> <87r1a07qft.fsf@eder.anydns.info>
<sq88pt$kpo$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="33484ae21c326c5b0c12a63d5a31b9a5";
logging-data="16615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DrJUBt0A7QhLdfalzZiI9"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Cancel-Lock: sha1:bgQUf+UiMmdEh/vXVcw/SvIvcTY=
sha1:UYfrisfrC7hre+HQ4+I12crKD24=
 by: Andreas Eder - Sun, 26 Dec 2021 09:36 UTC

On Sa 25 Dez 2021 at 15:17, Bakul Shah <bakul@iitbombay.org> wrote:

> Can any of the RnRS Schemes do reader macros?

No, I don't think so.
But reader macros are a different kettle of fish.

'Andreas

Re: Dense machine code from C++ code (compiler optimizations)

<86zgonza5o.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22458&group=comp.arch#22458

  copy link   Newsgroups: comp.arch
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.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Sun, 26 Dec 2021 06:57:23 -0800
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <86zgonza5o.fsf@linuxsc.com>
References: <sndun6$q07$1@dont-email.me> <dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com> <sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me> <spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me> <86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me> <sq2hfi$lah$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="8ba95f25b1dd42bf3fe96f3dac02024e";
logging-data="18171"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+A2zOYtAp6OqNSv9e0wqGzsKceK6r4iNo="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:sQzcobLDOQGQPRTNt9Gy3NKurD8=
sha1:gN4kzytklS3+f5Aoo2/2KxvZb7M=
 by: Tim Rentsch - Sun, 26 Dec 2021 14:57 UTC

Guillaume <message@bottle.org> writes:

>> [suggestion to add a simple feature to the C standard]

> [...] as far as I've seen, the process of adding a new feature in
> the C standard usually implies that it can't be done portably
> otherwise.

Certainly that has been the case up to now.

Re: Dense machine code from C++ code (compiler optimizations)

<86v8zbz9ts.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22459&group=comp.arch#22459

  copy link   Newsgroups: comp.arch
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.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Sun, 26 Dec 2021 07:04:31 -0800
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <86v8zbz9ts.fsf@linuxsc.com>
References: <sndun6$q07$1@dont-email.me> <dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com> <sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me> <spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me> <86mtks1j79.fsf@linuxsc.com> <sq372j$80q$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="8ba95f25b1dd42bf3fe96f3dac02024e";
logging-data="18171"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eDnQaoo6ucPboDSz8yoWfObpt4EZGnAY="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:CYORmZLNGjeLs+IvJc+yQ3wdwAU=
sha1:U22O7o/Gwg8jiYJm+4kYi2CqPwM=
 by: Tim Rentsch - Sun, 26 Dec 2021 15:04 UTC

Ivan Godard <ivan@millcomputing.com> writes:

> On 12/22/2021 12:24 PM, Tim Rentsch wrote:
> <snip>
>
>> Not necessarily an answer but an observation: in C no new language
>> feature is needed, because C has the C preprocessor. It isn't hard
>> to write a macro that does the necessary shifting and masking (and
>> these days compilers are mostly smart enough to recognize the common
>> patterns and translate them efficiently and in machine-specific
>> ways).
>
> The C preprocessor is an invention of the Devil.

Note that I was neither touting nor defending the C preprocessor.
Just making an observation.

> It lacks the power of a real macro language like m4, yet has all
> the drawbacks of scopeless text substitution.

In the particular case of handling bit subfields, scopeless text
substitution is well up to the job.

Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)

<jwvk0frff4e.fsf-monnier+comp.arch@gnu.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22461&group=comp.arch#22461

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: monn...@iro.umontreal.ca (Stefan Monnier)
Newsgroups: comp.arch
Subject: Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)
Date: Sun, 26 Dec 2021 12:32:07 -0500
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <jwvk0frff4e.fsf-monnier+comp.arch@gnu.org>
References: <sndun6$q07$1@dont-email.me> <sq372j$80q$1@dont-email.me>
<sq4l7a$21u$1@newsreader4.netcologne.de> <sq4p88$77q$1@dont-email.me>
<sq5865$1cn9$1@gal.iecc.com>
<b23bb66b-d466-4b2d-be44-ffb2c6dfceeen@googlegroups.com>
<sq5hj8$mhh$1@newsreader4.netcologne.de>
<OTJxJ.174251$831.148123@fx40.iad>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="47d8e2b2e214826dbb45d3abcf84f450";
logging-data="17425"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sf+lJBQBzOZ1qHawB7fCo"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Cancel-Lock: sha1:Sm/MOACF0QcA6oxAP/v6wKhghEY=
sha1:MOGDMe49EvkCHuTwTvmLu5aFzF8=
 by: Stefan Monnier - Sun, 26 Dec 2021 17:32 UTC

> About 25 or so years ago I wrote an LALR(1) table generator and parser
> with autocorrect. Autocorrect worked quite well.

I'm still wondering why these kinds of parsers aren't more common.
I find them great for users in that they not only pin point syntax
errors but they even come with a clear description of how it can be
fixed. It's hard to generate error message of comparable value by hand.

Stefan

Re: Dense machine code from C++ code (compiler optimizations)

<86r19yzby6.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22476&group=comp.arch#22476

  copy link   Newsgroups: comp.arch
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.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 00:30:57 -0800
Organization: A noiseless patient Spider
Lines: 93
Message-ID: <86r19yzby6.fsf@linuxsc.com>
References: <sndun6$q07$1@dont-email.me> <dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com> <sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me> <spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me> <86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="045a9cd459c07439e0ee06f5df5850b8";
logging-data="24439"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+05iNGvKT+nKZWx+gEzrr6oiDuarKaUAM="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:I2eKNtjWdti/zGeVo5JpRfNTNgo=
sha1:aXcJcS+HK0HjU5r9sFHeviRdXUE=
 by: Tim Rentsch - Mon, 27 Dec 2021 08:30 UTC

Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:

> On 12/22/2021 12:24 PM, Tim Rentsch wrote:
>
>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>>
>>> On 12/20/2021 10:21 AM, James Van Buskirk wrote:
>>>
>>>> "Stephen Fuld" wrote in message news:spqc1d$oio$1@dont-email.me...
>>>>
>>>>> A compiler I used to use (it was for Fortran, but this
>>>>> functionality is not Fortran specific) had a pseudo function named
>>>>> "Bits". It looked like a function that accepted three arguments,
>>>>> a variable name and a starting bit number and number of bits, both
>>>>> of which could be a constant or an integer variable. One of its
>>>>> unique properties is that it could also be used on the left hand
>>>>> side of an assignment statement.
>>>>>
>>>>> This feature led to very clear, concise code, that the compiler
>>>>> didn't have to go through a complex algorithms to recognize, and
>>>>> would generate optimal, inline code. There was sort of a pragma
>>>>> that could optionally generate checking code for out of range
>>>>> combinations of length and starting bit number.
>>>>>
>>>>> So, for example, the source code to move two bits starting at bit
>>>>> 3 of variable B to starting at bit 4 of variable A would be
>>>>>
>>>>> Bits (A, 2, 4) = Bits (B, 2, 3)
>>>>>
>>>>> I always liked this feature, and used it a fair amount.
>>>>
>>>> Compare
>>>> https://gcc.gnu.org/onlinedocs/gfortran/IBITS.html#IBITS
>>>> https://gcc.gnu.org/onlinedocs/gfortran/MVBITS.html#MVBITS
>>>> which are both elemental.
>>>
>>> They seem essentially equivalent. It says that these came in with
>>> Fortran 90. The compiler I was referring to had its roots in a
>>> predecessor with a different name that dated back to at least the
>>> early 1970s. I am glad the idea became standardized.
>>>
>>> I guess I should ask the question that given that C is probably used
>>> for bit manipulation stuff at least as much as Fortran, how come the
>>> C standard didn't pick up some equivalent?
>>
>> Not necessarily an answer but an observation: in C no new language
>> feature is needed, because C has the C preprocessor. It isn't hard
>> to write a macro that does the necessary shifting and masking (and
>> these days compilers are mostly smart enough to recognize the common
>> patterns and translate them efficiently and in machine-specific
>> ways).
>
> While you are right, of course, about the preprocessor, I guess it
> comes down to me having a different philosophy of language design,
> than what Mitch expressed in his (sarcastic) comment.

Sorry, I thought the question was why it hasn't been done, not
why it should or shouldn't be done.

>> Having a straightforward way to succinctly express the requirement
>> is <ahem> Not 'C'.

You are attributing to me something I didn't say. Please don't
do that.

> The problem with the preprocessor approach is that everyone will
> code their own macro, possibly with different syntax, so I have to
> learn what you did, then if I move to a different project, what they
> did etc. That is the beauty of a standard. (Unless you are talking
> about having the preprocessor macro standardized.)
>
> Compare with, for example, integer division. It is part of the
> standard, even though fairly rarely used. If bit field extraction
> and insertion are reasonably well used (and I am guessing they are -
> at least as much as they are used in Fortran, though probably less
> than division), then I feel they should be standardized to ease the
> programmer's job.

Manipulating bit fields can easily be synthesized using other
existing operators. Division does not have that property.

Also there is the question of how often shift/masking bitfield
manipulation comes up. I have looked at a fair bit of C code
over the years and I just don't see this very often. Probably it
does occur routinely in some application areas, but certainly not
most of them.

The idea that feature X should be added to a language standard
just for the sake of commonality leads inexorably to a language
overloaded with features that are used only rarely. Better to
follow the principle expressed by Tony Hoare: a language should
have only those features that are going to be used in every
program.

Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)

<86mtkmzb7v.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22477&group=comp.arch#22477

  copy link   Newsgroups: comp.arch
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.arch
Subject: Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 00:46:44 -0800
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <86mtkmzb7v.fsf@linuxsc.com>
References: <sndun6$q07$1@dont-email.me> <sq372j$80q$1@dont-email.me> <sq4l7a$21u$1@newsreader4.netcologne.de> <sq4p88$77q$1@dont-email.me> <sq5865$1cn9$1@gal.iecc.com> <541dba94-b488-44e5-a939-1557f3ea9709n@googlegroups.com> <sq5mga$k9o$1@dont-email.me> <sq65vu$pcc$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="045a9cd459c07439e0ee06f5df5850b8";
logging-data="24439"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199BygM6M+diQe49aW+zXmAZ9J/4PnYYTc="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:h/AdR5ZGpkVb+dNHTCaVy1cMqBg=
sha1:3PN2BLGtgkLhYf788WZYXkbUDH8=
 by: Tim Rentsch - Mon, 27 Dec 2021 08:46 UTC

Ivan Godard <ivan@millcomputing.com> writes:

> On 12/24/2021 3:52 PM, Bakul Shah wrote:
>
>> On 12/24/21 1:29 PM, JimBrakefield wrote:
>>
>>> At my current level of understanding:
>>> An interesting feature of Zig is that instead of a macro or
>>> preprocessor the compiler
>>> will execute at compile time anything the can be computed at compile time
>>> (including type expressions). Thus the language itself is it's own
>>> preprocessor.
>>> And like the RTL languages, simplification and reduction is carried
>>> as far as possible.
>>
>> The "V" language also does this. But this is not the same as decent
>> macro processing. Scheme/CL macros allow you to abstract away details
>> very nicely but for that to work, there needs to a language syntax model
>> the macros can access. This is much simpler in S-expr languages since
>> the AST *is* the concrete syntax (more or less)!
>
> SmallTalk

Let me remind you again: Smalltalk, not SmallTalk.

> had the execution context accessible and mutable by the
> running program, including during translation.

When code is running, yes. When code is being compiled, no.
It's been quite a few years since I used a Smalltalk system,
but most code was written and compiled using a conventional
compilation model, without any way to execute code as part
of the compilation process.

Re: Dense machine code from C++ code (compiler optimizations)

<86ilvazavv.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22478&group=comp.arch#22478

  copy link   Newsgroups: comp.arch
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.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 00:53:56 -0800
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <86ilvazavv.fsf@linuxsc.com>
References: <sndun6$q07$1@dont-email.me> <dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com> <sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me> <spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me> <86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me> <sq2hfi$lah$1@gioia.aioe.org> <cc7b7735-d386-4b43-ac97-035c647d7f05n@googlegroups.com> <sq2vkc$qp3$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="045a9cd459c07439e0ee06f5df5850b8";
logging-data="24439"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+x4M2tpnzS02kazvkYhn2QCWUzRfODYpE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:mBdmO539l/F7IogyVzJcDShH8+c=
sha1:blOgWJevSPwc1hoboHl8poj5SDA=
 by: Tim Rentsch - Mon, 27 Dec 2021 08:53 UTC

Guillaume <message@bottle.org> writes:

> Le 23/12/2021 at 20:37, MitchAlsup a ecrit:
>
>> The only benefit to developers would be some kind of syntactic
>> sugar to make bit fields easier to specify::
>> a<3:17> = b<9:23>;
>
> Oh, I perfectly get that, and I agree this notation would be quite
> nice.
>
>> Macros seem to fail in that they cannot do syntactic sugar things.
>
> Not this kind, indeed. But the whole question regarding the
> standard is, is it really worth it to make additions to it just
> for some syntactic sugar? This is not the spirit of C.
>
> But in that same vein, I would have a number of other notations I
> would like to have in C. A lot more than just this. Thing is,
> who knows where that would lead the language.

If you got some other people to join you and add their notations
to yours, it would lead C further down the path of turning C into
the clusterfuck that C++ has become. (And I should add, with no
disrespect intended for the features you are considering.)

I predict it won't be too long before someone suggests adding
templates to C. There is already a proposal to add constexpr.
Ick.

Re: Macros, threat or menace, was Dense machine code from C++ code (compiler optimizations)

<sqc8br$ib4$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22482&group=comp.arch#22482

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: iva...@millcomputing.com (Ivan Godard)
Newsgroups: comp.arch
Subject: Re: Macros, threat or menace, was Dense machine code from C++ code
(compiler optimizations)
Date: Mon, 27 Dec 2021 03:34:20 -0800
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <sqc8br$ib4$2@dont-email.me>
References: <sndun6$q07$1@dont-email.me> <sq372j$80q$1@dont-email.me>
<sq4l7a$21u$1@newsreader4.netcologne.de> <sq4p88$77q$1@dont-email.me>
<sq5865$1cn9$1@gal.iecc.com>
<541dba94-b488-44e5-a939-1557f3ea9709n@googlegroups.com>
<sq5mga$k9o$1@dont-email.me> <sq65vu$pcc$1@dont-email.me>
<86mtkmzb7v.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Dec 2021 11:34:19 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="adc697d50b56aaf743b4a8fa705f79dd";
logging-data="18788"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+m/FCg+iyJC+NSwPfml/ba"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.1
Cancel-Lock: sha1:DySfWr+xOTGab8DzbZn1cp4Fo3o=
In-Reply-To: <86mtkmzb7v.fsf@linuxsc.com>
Content-Language: en-US
 by: Ivan Godard - Mon, 27 Dec 2021 11:34 UTC

On 12/27/2021 12:46 AM, Tim Rentsch wrote:
> Ivan Godard <ivan@millcomputing.com> writes:
>
>> On 12/24/2021 3:52 PM, Bakul Shah wrote:
>>
>>> On 12/24/21 1:29 PM, JimBrakefield wrote:
>>>
>>>> At my current level of understanding:
>>>> An interesting feature of Zig is that instead of a macro or
>>>> preprocessor the compiler
>>>> will execute at compile time anything the can be computed at compile time
>>>> (including type expressions). Thus the language itself is it's own
>>>> preprocessor.
>>>> And like the RTL languages, simplification and reduction is carried
>>>> as far as possible.
>>>
>>> The "V" language also does this. But this is not the same as decent
>>> macro processing. Scheme/CL macros allow you to abstract away details
>>> very nicely but for that to work, there needs to a language syntax model
>>> the macros can access. This is much simpler in S-expr languages since
>>> the AST *is* the concrete syntax (more or less)!
>>
>> SmallTalk
>
> Let me remind you again: Smalltalk, not SmallTalk.
>
>> had the execution context accessible and mutable by the
>> running program, including during translation.
>
> When code is running, yes. When code is being compiled, no.
> It's been quite a few years since I used a Smalltalk system,
> but most code was written and compiled using a conventional
> compilation model, without any way to execute code as part
> of the compilation process.

Yes: most people use only the first order aspects of second order systems.

Re: Dense machine code from C++ code (compiler optimizations)

<sqcs2u$mba$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22488&group=comp.arch#22488

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: sfu...@alumni.cmu.edu.invalid (Stephen Fuld)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 09:10:51 -0800
Organization: A noiseless patient Spider
Lines: 131
Message-ID: <sqcs2u$mba$1@dont-email.me>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
<86r19yzby6.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Dec 2021 17:10:54 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="9191d883c21b591ee61d0e1008b9dcfb";
logging-data="22890"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4fnn4x2HCsuQhgBPIJ6ySaS8ExcN7i0U="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.1
Cancel-Lock: sha1:wTfY0+5zBgq3Ij1IYEmlozse844=
In-Reply-To: <86r19yzby6.fsf@linuxsc.com>
Content-Language: en-US
 by: Stephen Fuld - Mon, 27 Dec 2021 17:10 UTC

On 12/27/2021 12:30 AM, Tim Rentsch wrote:
> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>
>> On 12/22/2021 12:24 PM, Tim Rentsch wrote:
>>
>>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>>>
>>>> On 12/20/2021 10:21 AM, James Van Buskirk wrote:
>>>>
>>>>> "Stephen Fuld" wrote in message news:spqc1d$oio$1@dont-email.me...
>>>>>
>>>>>> A compiler I used to use (it was for Fortran, but this
>>>>>> functionality is not Fortran specific) had a pseudo function named
>>>>>> "Bits". It looked like a function that accepted three arguments,
>>>>>> a variable name and a starting bit number and number of bits, both
>>>>>> of which could be a constant or an integer variable. One of its
>>>>>> unique properties is that it could also be used on the left hand
>>>>>> side of an assignment statement.
>>>>>>
>>>>>> This feature led to very clear, concise code, that the compiler
>>>>>> didn't have to go through a complex algorithms to recognize, and
>>>>>> would generate optimal, inline code. There was sort of a pragma
>>>>>> that could optionally generate checking code for out of range
>>>>>> combinations of length and starting bit number.
>>>>>>
>>>>>> So, for example, the source code to move two bits starting at bit
>>>>>> 3 of variable B to starting at bit 4 of variable A would be
>>>>>>
>>>>>> Bits (A, 2, 4) = Bits (B, 2, 3)
>>>>>>
>>>>>> I always liked this feature, and used it a fair amount.
>>>>>
>>>>> Compare
>>>>> https://gcc.gnu.org/onlinedocs/gfortran/IBITS.html#IBITS
>>>>> https://gcc.gnu.org/onlinedocs/gfortran/MVBITS.html#MVBITS
>>>>> which are both elemental.
>>>>
>>>> They seem essentially equivalent. It says that these came in with
>>>> Fortran 90. The compiler I was referring to had its roots in a
>>>> predecessor with a different name that dated back to at least the
>>>> early 1970s. I am glad the idea became standardized.
>>>>
>>>> I guess I should ask the question that given that C is probably used
>>>> for bit manipulation stuff at least as much as Fortran, how come the
>>>> C standard didn't pick up some equivalent?
>>>
>>> Not necessarily an answer but an observation: in C no new language
>>> feature is needed, because C has the C preprocessor. It isn't hard
>>> to write a macro that does the necessary shifting and masking (and
>>> these days compilers are mostly smart enough to recognize the common
>>> patterns and translate them efficiently and in machine-specific
>>> ways).
>>
>> While you are right, of course, about the preprocessor, I guess it
>> comes down to me having a different philosophy of language design,
>> than what Mitch expressed in his (sarcastic) comment.
>
> Sorry, I thought the question was why it hasn't been done, not
> why it should or shouldn't be done.
>
>>> Having a straightforward way to succinctly express the requirement
>>> is <ahem> Not 'C'.
>
> You are attributing to me something I didn't say. Please don't
> do that.

Sorry, I thought that it was clear that I was quoting Mitch, not you.

>> The problem with the preprocessor approach is that everyone will
>> code their own macro, possibly with different syntax, so I have to
>> learn what you did, then if I move to a different project, what they
>> did etc. That is the beauty of a standard. (Unless you are talking
>> about having the preprocessor macro standardized.)
>>
>> Compare with, for example, integer division. It is part of the
>> standard, even though fairly rarely used. If bit field extraction
>> and insertion are reasonably well used (and I am guessing they are -
>> at least as much as they are used in Fortran, though probably less
>> than division), then I feel they should be standardized to ease the
>> programmer's job.
>
> Manipulating bit fields can easily be synthesized using other
> existing operators. Division does not have that property.

I agree that division was a poorly chosen example. But synthesizing bit
fields can get fairly complex (variables for starting bit number and
length, potentially on both the source and the target, with checking to
insure the combinations of length and starting bit number are files are
legal). While you certainly can synthesize this, I would question
whether it is "easy", and, perhaps more importantly, easy for someone
else to comprehend and for you to debug, especially years later. Of
course, YMMV.

> Also there is the question of how often shift/masking bitfield
> manipulation comes up. I have looked at a fair bit of C code
> over the years and I just don't see this very often. Probably it
> does occur routinely in some application areas, but certainly not
> most of them.

I may be wrong, but I expect it occurs in many "close to the metal"
applications, such as embedded code and microcontrollers, OS code,
graphics, etc. ISTM that these are the areas (especially OS) that C was
designed for.

> The idea that feature X should be added to a language standard
> just for the sake of commonality leads inexorably to a language
> overloaded with features that are used only rarely.

Sure. Such decisions are always a tradeoff. But the standardizers of
Fortran apparently thought it occurs often enough to include it in that
language. As I said, however often you think it occurs, I expect that
it would occur more often in C than Fortran.

> Better to
> follow the principle expressed by Tony Hoare: a language should
> have only those features that are going to be used in every
> program.

While I am sure that comment was tongue in cheek, it clearly isn't
practical. The typical "Hello World" program uses no dynamic
allocation, arrays, indeed arithmetic, etc. I am sure that there are
very many C programs that include no floating point, yet I doubt you
oppose its inclusion.

--
- Stephen Fuld
(e-mail address disguised to prevent spam)

Re: Dense machine code from C++ code (compiler optimizations)

<sqd1hs$l2h$2@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22491&group=comp.arch#22491

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.de!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-eb03-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 18:44:12 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <sqd1hs$l2h$2@newsreader4.netcologne.de>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
<86r19yzby6.fsf@linuxsc.com>
Injection-Date: Mon, 27 Dec 2021 18:44:12 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-eb03-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:eb03:0:7285:c2ff:fe6c:992d";
logging-data="21585"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 27 Dec 2021 18:44 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> schrieb:
> Better to
> follow the principle expressed by Tony Hoare: a language should
> have only those features that are going to be used in every
> program.

Taken literally, that is rather extreme.

Would you ban file I/O because there are lots of useful programs
which only use standard input and standart output?

Re: Dense machine code from C++ code (compiler optimizations)

<sqd262$459$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22495&group=comp.arch#22495

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!UgLt14+w9tVHe1BtIa3HDQ.user.46.165.242.75.POSTED!not-for-mail
From: mess...@bottle.org (Guillaume)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 19:54:57 +0100
Organization: Aioe.org NNTP Server
Message-ID: <sqd262$459$1@gioia.aioe.org>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
<86r19yzby6.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="4265"; posting-host="UgLt14+w9tVHe1BtIa3HDQ.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.4.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: fr
 by: Guillaume - Mon, 27 Dec 2021 18:54 UTC

Le 27/12/2021 à 09:30, Tim Rentsch a écrit :
> The idea that feature X should be added to a language standard
> just for the sake of commonality leads inexorably to a language
> overloaded with features that are used only rarely.

Yes. And isn't that what C++ exactly is? =)
(Yes, it's a mess, but it might not be politically correct to say this.)

> Better to follow the principle expressed by Tony Hoare: a language should
> have only those features that are going to be used in every
> program.

Oh well. That statement is a bit extreme. But Hoare liked punch lines,
and the point is still made. =)

(Yes, of course extreme. Let's take a trivial example. One can write
entire programs that do not use a single division operator. Does that
mean one should remove it from the language, because not every program
uses it?)

I prefer Wirth's "Make it as simple as possible, but not simpler" quote
that can be found in the Oberon language specs. (And often attributed to
Einstein.) Seemingly conveys the same idea, but in a more realistic, if
slightly more abstract, form.

Re: Dense machine code from C++ code (compiler optimizations)

<d70f7290-a1c5-44d2-8384-056a1aa6498en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22498&group=comp.arch#22498

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:b2c1:: with SMTP id b184mr13474972qkf.53.1640632330600;
Mon, 27 Dec 2021 11:12:10 -0800 (PST)
X-Received: by 2002:a9d:7443:: with SMTP id p3mr13101874otk.331.1640632330351;
Mon, 27 Dec 2021 11:12:10 -0800 (PST)
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.arch
Date: Mon, 27 Dec 2021 11:12:10 -0800 (PST)
In-Reply-To: <86r19yzby6.fsf@linuxsc.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:7907:330c:656:c2fa;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:7907:330c:656:c2fa
References: <sndun6$q07$1@dont-email.me> <dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me> <86mtks1j79.fsf@linuxsc.com>
<sq2acu$hg3$1@dont-email.me> <86r19yzby6.fsf@linuxsc.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d70f7290-a1c5-44d2-8384-056a1aa6498en@googlegroups.com>
Subject: Re: Dense machine code from C++ code (compiler optimizations)
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Mon, 27 Dec 2021 19:12:10 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 98
 by: MitchAlsup - Mon, 27 Dec 2021 19:12 UTC

On Monday, December 27, 2021 at 2:31:05 AM UTC-6, Tim Rentsch wrote:
> Stephen Fuld <sf...@alumni.cmu.edu.invalid> writes:
>
> > On 12/22/2021 12:24 PM, Tim Rentsch wrote:
> >
> >> Stephen Fuld <sf...@alumni.cmu.edu.invalid> writes:
> >>
> >>> On 12/20/2021 10:21 AM, James Van Buskirk wrote:
> >>>
> >>>> "Stephen Fuld" wrote in message news:spqc1d$oio$1...@dont-email.me...
> >>>>
> >>>>> A compiler I used to use (it was for Fortran, but this
> >>>>> functionality is not Fortran specific) had a pseudo function named
> >>>>> "Bits". It looked like a function that accepted three arguments,
> >>>>> a variable name and a starting bit number and number of bits, both
> >>>>> of which could be a constant or an integer variable. One of its
> >>>>> unique properties is that it could also be used on the left hand
> >>>>> side of an assignment statement.
> >>>>>
> >>>>> This feature led to very clear, concise code, that the compiler
> >>>>> didn't have to go through a complex algorithms to recognize, and
> >>>>> would generate optimal, inline code. There was sort of a pragma
> >>>>> that could optionally generate checking code for out of range
> >>>>> combinations of length and starting bit number.
> >>>>>
> >>>>> So, for example, the source code to move two bits starting at bit
> >>>>> 3 of variable B to starting at bit 4 of variable A would be
> >>>>>
> >>>>> Bits (A, 2, 4) = Bits (B, 2, 3)
> >>>>>
> >>>>> I always liked this feature, and used it a fair amount.
> >>>>
> >>>> Compare
> >>>> https://gcc.gnu.org/onlinedocs/gfortran/IBITS.html#IBITS
> >>>> https://gcc.gnu.org/onlinedocs/gfortran/MVBITS.html#MVBITS
> >>>> which are both elemental.
> >>>
> >>> They seem essentially equivalent. It says that these came in with
> >>> Fortran 90. The compiler I was referring to had its roots in a
> >>> predecessor with a different name that dated back to at least the
> >>> early 1970s. I am glad the idea became standardized.
> >>>
> >>> I guess I should ask the question that given that C is probably used
> >>> for bit manipulation stuff at least as much as Fortran, how come the
> >>> C standard didn't pick up some equivalent?
> >>
> >> Not necessarily an answer but an observation: in C no new language
> >> feature is needed, because C has the C preprocessor. It isn't hard
> >> to write a macro that does the necessary shifting and masking (and
> >> these days compilers are mostly smart enough to recognize the common
> >> patterns and translate them efficiently and in machine-specific
> >> ways).
> >
> > While you are right, of course, about the preprocessor, I guess it
> > comes down to me having a different philosophy of language design,
> > than what Mitch expressed in his (sarcastic) comment.
>
> Sorry, I thought the question was why it hasn't been done, not
> why it should or shouldn't be done.
>
> >> Having a straightforward way to succinctly express the requirement
> >> is <ahem> Not 'C'.
>
> You are attributing to me something I didn't say. Please don't
> do that.
<
The attribution goes all the bay back to a cute girl from HP on the C89
ANSI effort.
>
> > The problem with the preprocessor approach is that everyone will
> > code their own macro, possibly with different syntax, so I have to
> > learn what you did, then if I move to a different project, what they
> > did etc. That is the beauty of a standard. (Unless you are talking
> > about having the preprocessor macro standardized.)
> >
> > Compare with, for example, integer division. It is part of the
> > standard, even though fairly rarely used. If bit field extraction
> > and insertion are reasonably well used (and I am guessing they are -
> > at least as much as they are used in Fortran, though probably less
> > than division), then I feel they should be standardized to ease the
> > programmer's job.
>
> Manipulating bit fields can easily be synthesized using other
> existing operators. Division does not have that property.
>
> Also there is the question of how often shift/masking bitfield
> manipulation comes up. I have looked at a fair bit of C code
> over the years and I just don't see this very often. Probably it
> does occur routinely in some application areas, but certainly not
> most of them.
>
> The idea that feature X should be added to a language standard
> just for the sake of commonality leads inexorably to a language
> overloaded with features that are used only rarely. Better to
> follow the principle expressed by Tony Hoare: a language should
> have only those features that are going to be used in every
> program.
<
So, printf() should not be in the language: check.

Re: Dense machine code from C++ code (compiler optimizations)

<7cd4982b-bc3d-439b-b9bb-21d70f4b1f46n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22500&group=comp.arch#22500

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:2d5:: with SMTP id a21mr16307354qtx.56.1640634627368;
Mon, 27 Dec 2021 11:50:27 -0800 (PST)
X-Received: by 2002:a05:6808:1283:: with SMTP id a3mr14245301oiw.110.1640634627129;
Mon, 27 Dec 2021 11:50:27 -0800 (PST)
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.arch
Date: Mon, 27 Dec 2021 11:50:26 -0800 (PST)
In-Reply-To: <sqcs2u$mba$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:65dd:bb7:48b5:b678;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:65dd:bb7:48b5:b678
References: <sndun6$q07$1@dont-email.me> <dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me> <86mtks1j79.fsf@linuxsc.com>
<sq2acu$hg3$1@dont-email.me> <86r19yzby6.fsf@linuxsc.com> <sqcs2u$mba$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7cd4982b-bc3d-439b-b9bb-21d70f4b1f46n@googlegroups.com>
Subject: Re: Dense machine code from C++ code (compiler optimizations)
From: already5...@yahoo.com (Michael S)
Injection-Date: Mon, 27 Dec 2021 19:50:27 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 125
 by: Michael S - Mon, 27 Dec 2021 19:50 UTC

On Monday, December 27, 2021 at 7:10:56 PM UTC+2, Stephen Fuld wrote:
> On 12/27/2021 12:30 AM, Tim Rentsch wrote:
> > Stephen Fuld <sf...@alumni.cmu.edu.invalid> writes:
> >
> >> On 12/22/2021 12:24 PM, Tim Rentsch wrote:
> >>
> >>> Stephen Fuld <sf...@alumni.cmu.edu.invalid> writes:
> >>>
> >>>> On 12/20/2021 10:21 AM, James Van Buskirk wrote:
> >>>>
> >>>>> "Stephen Fuld" wrote in message news:spqc1d$oio$1...@dont-email.me...
> >>>>>
> >>>>>> A compiler I used to use (it was for Fortran, but this
> >>>>>> functionality is not Fortran specific) had a pseudo function named
> >>>>>> "Bits". It looked like a function that accepted three arguments,
> >>>>>> a variable name and a starting bit number and number of bits, both
> >>>>>> of which could be a constant or an integer variable. One of its
> >>>>>> unique properties is that it could also be used on the left hand
> >>>>>> side of an assignment statement.
> >>>>>>
> >>>>>> This feature led to very clear, concise code, that the compiler
> >>>>>> didn't have to go through a complex algorithms to recognize, and
> >>>>>> would generate optimal, inline code. There was sort of a pragma
> >>>>>> that could optionally generate checking code for out of range
> >>>>>> combinations of length and starting bit number.
> >>>>>>
> >>>>>> So, for example, the source code to move two bits starting at bit
> >>>>>> 3 of variable B to starting at bit 4 of variable A would be
> >>>>>>
> >>>>>> Bits (A, 2, 4) = Bits (B, 2, 3)
> >>>>>>
> >>>>>> I always liked this feature, and used it a fair amount.
> >>>>>
> >>>>> Compare
> >>>>> https://gcc.gnu.org/onlinedocs/gfortran/IBITS.html#IBITS
> >>>>> https://gcc.gnu.org/onlinedocs/gfortran/MVBITS.html#MVBITS
> >>>>> which are both elemental.
> >>>>
> >>>> They seem essentially equivalent. It says that these came in with
> >>>> Fortran 90. The compiler I was referring to had its roots in a
> >>>> predecessor with a different name that dated back to at least the
> >>>> early 1970s. I am glad the idea became standardized.
> >>>>
> >>>> I guess I should ask the question that given that C is probably used
> >>>> for bit manipulation stuff at least as much as Fortran, how come the
> >>>> C standard didn't pick up some equivalent?
> >>>
> >>> Not necessarily an answer but an observation: in C no new language
> >>> feature is needed, because C has the C preprocessor. It isn't hard
> >>> to write a macro that does the necessary shifting and masking (and
> >>> these days compilers are mostly smart enough to recognize the common
> >>> patterns and translate them efficiently and in machine-specific
> >>> ways).
> >>
> >> While you are right, of course, about the preprocessor, I guess it
> >> comes down to me having a different philosophy of language design,
> >> than what Mitch expressed in his (sarcastic) comment.
> >
> > Sorry, I thought the question was why it hasn't been done, not
> > why it should or shouldn't be done.
> >
> >>> Having a straightforward way to succinctly express the requirement
> >>> is <ahem> Not 'C'.
> >
> > You are attributing to me something I didn't say. Please don't
> > do that.
> Sorry, I thought that it was clear that I was quoting Mitch, not you.
> >> The problem with the preprocessor approach is that everyone will
> >> code their own macro, possibly with different syntax, so I have to
> >> learn what you did, then if I move to a different project, what they
> >> did etc. That is the beauty of a standard. (Unless you are talking
> >> about having the preprocessor macro standardized.)
> >>
> >> Compare with, for example, integer division. It is part of the
> >> standard, even though fairly rarely used. If bit field extraction
> >> and insertion are reasonably well used (and I am guessing they are -
> >> at least as much as they are used in Fortran, though probably less
> >> than division), then I feel they should be standardized to ease the
> >> programmer's job.
> >
> > Manipulating bit fields can easily be synthesized using other
> > existing operators. Division does not have that property.
> I agree that division was a poorly chosen example. But synthesizing bit
> fields can get fairly complex (variables for starting bit number and
> length, potentially on both the source and the target, with checking to
> insure the combinations of length and starting bit number are files are
> legal). While you certainly can synthesize this, I would question
> whether it is "easy", and, perhaps more importantly, easy for someone
> else to comprehend and for you to debug, especially years later. Of
> course, YMMV.
> > Also there is the question of how often shift/masking bitfield
> > manipulation comes up. I have looked at a fair bit of C code
> > over the years and I just don't see this very often. Probably it
> > does occur routinely in some application areas, but certainly not
> > most of them.
> I may be wrong, but I expect it occurs in many "close to the metal"
> applications, such as embedded code and microcontrollers, OS code,
> graphics, etc. ISTM that these are the areas (especially OS) that C was
> designed for.

I did and do spend significant portion of my time as sw developer in at least part of the above mentioned areas.
And my experience is that it's not a case.
I mean, both extraction from bit field to scalar and insertion of scalar into bit field are indeed not very rare.
But copying of one bit field into another is extremely rare.

> > The idea that feature X should be added to a language standard
> > just for the sake of commonality leads inexorably to a language
> > overloaded with features that are used only rarely.
> Sure. Such decisions are always a tradeoff. But the standardizers of
> Fortran apparently thought it occurs often enough to include it in that
> language. As I said, however often you think it occurs, I expect that
> it would occur more often in C than Fortran.
> > Better to
> > follow the principle expressed by Tony Hoare: a language should
> > have only those features that are going to be used in every
> > program.
> While I am sure that comment was tongue in cheek, it clearly isn't
> practical. The typical "Hello World" program uses no dynamic
> allocation, arrays, indeed arithmetic, etc. I am sure that there are
> very many C programs that include no floating point, yet I doubt you
> oppose its inclusion.
>
>
> --
> - Stephen Fuld
> (e-mail address disguised to prevent spam)

Re: Dense machine code from C++ code (compiler optimizations)

<sqd6n3$va5$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22501&group=comp.arch#22501

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: sfu...@alumni.cmu.edu.invalid (Stephen Fuld)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 12:12:16 -0800
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <sqd6n3$va5$1@dont-email.me>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
<86r19yzby6.fsf@linuxsc.com> <sqcs2u$mba$1@dont-email.me>
<7cd4982b-bc3d-439b-b9bb-21d70f4b1f46n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Dec 2021 20:12:19 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="9191d883c21b591ee61d0e1008b9dcfb";
logging-data="32069"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ZGlH5aF4qy4y4oSpIt+f8Vbi2OdMjWQg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.1
Cancel-Lock: sha1:3buXoeYBOQaz4LbLbheIjHyjvvg=
In-Reply-To: <7cd4982b-bc3d-439b-b9bb-21d70f4b1f46n@googlegroups.com>
Content-Language: en-US
 by: Stephen Fuld - Mon, 27 Dec 2021 20:12 UTC

On 12/27/2021 11:50 AM, Michael S wrote:
> On Monday, December 27, 2021 at 7:10:56 PM UTC+2, Stephen Fuld wrote:
>> On 12/27/2021 12:30 AM, Tim Rentsch wrote:

snip

>>> Also there is the question of how often shift/masking bitfield
>>> manipulation comes up. I have looked at a fair bit of C code
>>> over the years and I just don't see this very often. Probably it
>>> does occur routinely in some application areas, but certainly not
>>> most of them.
>> I may be wrong, but I expect it occurs in many "close to the metal"
>> applications, such as embedded code and microcontrollers, OS code,
>> graphics, etc. ISTM that these are the areas (especially OS) that C was
>> designed for.
>
> I did and do spend significant portion of my time as sw developer in at least part of the above mentioned areas.
> And my experience is that it's not a case.
> I mean, both extraction from bit field to scalar and insertion of scalar into bit field are indeed not very rare.
> But copying of one bit field into another is extremely rare.

Oh, I agree with that. But once you have the "syntactical sugar" of
pseudo functions for extraction and insertion, the copying is just there
for free.

--
- Stephen Fuld
(e-mail address disguised to prevent spam)

Re: Dense machine code from C++ code (compiler optimizations)

<5dc26a2e-13fa-4e0d-be99-90f6e164c066n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22502&group=comp.arch#22502

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:3187:: with SMTP id bi7mr13636147qkb.534.1640638473586;
Mon, 27 Dec 2021 12:54:33 -0800 (PST)
X-Received: by 2002:aca:646:: with SMTP id 67mr14406533oig.175.1640638473353;
Mon, 27 Dec 2021 12:54:33 -0800 (PST)
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.arch
Date: Mon, 27 Dec 2021 12:54:33 -0800 (PST)
In-Reply-To: <sqd6n3$va5$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:65dd:bb7:48b5:b678;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:65dd:bb7:48b5:b678
References: <sndun6$q07$1@dont-email.me> <dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me> <86mtks1j79.fsf@linuxsc.com>
<sq2acu$hg3$1@dont-email.me> <86r19yzby6.fsf@linuxsc.com> <sqcs2u$mba$1@dont-email.me>
<7cd4982b-bc3d-439b-b9bb-21d70f4b1f46n@googlegroups.com> <sqd6n3$va5$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5dc26a2e-13fa-4e0d-be99-90f6e164c066n@googlegroups.com>
Subject: Re: Dense machine code from C++ code (compiler optimizations)
From: already5...@yahoo.com (Michael S)
Injection-Date: Mon, 27 Dec 2021 20:54:33 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 28
 by: Michael S - Mon, 27 Dec 2021 20:54 UTC

On Monday, December 27, 2021 at 10:12:22 PM UTC+2, Stephen Fuld wrote:
> On 12/27/2021 11:50 AM, Michael S wrote:
> > On Monday, December 27, 2021 at 7:10:56 PM UTC+2, Stephen Fuld wrote:
> >> On 12/27/2021 12:30 AM, Tim Rentsch wrote:
> snip
> >>> Also there is the question of how often shift/masking bitfield
> >>> manipulation comes up. I have looked at a fair bit of C code
> >>> over the years and I just don't see this very often. Probably it
> >>> does occur routinely in some application areas, but certainly not
> >>> most of them.
> >> I may be wrong, but I expect it occurs in many "close to the metal"
> >> applications, such as embedded code and microcontrollers, OS code,
> >> graphics, etc. ISTM that these are the areas (especially OS) that C was
> >> designed for.
> >
> > I did and do spend significant portion of my time as sw developer in at least part of the above mentioned areas.
> > And my experience is that it's not a case.
> > I mean, both extraction from bit field to scalar and insertion of scalar into bit field are indeed not very rare.
> > But copying of one bit field into another is extremely rare.
> Oh, I agree with that. But once you have the "syntactical sugar" of
> pseudo functions for extraction and insertion, the copying is just there
> for free.

But both for extraction to scalar and for insertion from scalar what Tim said is true - doing them with shifts and masks is easy and not error-prone.
Pay attention that "extraction to scalar" and "insertion from scalar" implies that the bit field is no wider than widest scalar [integer] data type of a given machine, which is already quite significant simplification.

> --
> - Stephen Fuld
> (e-mail address disguised to prevent spam)

Re: Dense machine code from C++ code (compiler optimizations)

<sqd9qe$i33$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22503&group=comp.arch#22503

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: sfu...@alumni.cmu.edu.invalid (Stephen Fuld)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 13:05:17 -0800
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <sqd9qe$i33$1@dont-email.me>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
<86r19yzby6.fsf@linuxsc.com> <sqcs2u$mba$1@dont-email.me>
<7cd4982b-bc3d-439b-b9bb-21d70f4b1f46n@googlegroups.com>
<sqd6n3$va5$1@dont-email.me>
<5dc26a2e-13fa-4e0d-be99-90f6e164c066n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Dec 2021 21:05:18 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="9191d883c21b591ee61d0e1008b9dcfb";
logging-data="18531"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+uugkCNmtJKUpeO8aVzTiSmIfy0/MJdrc="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.1
Cancel-Lock: sha1:jaA/zrvLzbLPXGjIndhHFNbkMK4=
In-Reply-To: <5dc26a2e-13fa-4e0d-be99-90f6e164c066n@googlegroups.com>
Content-Language: en-US
 by: Stephen Fuld - Mon, 27 Dec 2021 21:05 UTC

On 12/27/2021 12:54 PM, Michael S wrote:
> On Monday, December 27, 2021 at 10:12:22 PM UTC+2, Stephen Fuld wrote:
>> On 12/27/2021 11:50 AM, Michael S wrote:
>>> On Monday, December 27, 2021 at 7:10:56 PM UTC+2, Stephen Fuld wrote:
>>>> On 12/27/2021 12:30 AM, Tim Rentsch wrote:
>> snip
>>>>> Also there is the question of how often shift/masking bitfield
>>>>> manipulation comes up. I have looked at a fair bit of C code
>>>>> over the years and I just don't see this very often. Probably it
>>>>> does occur routinely in some application areas, but certainly not
>>>>> most of them.
>>>> I may be wrong, but I expect it occurs in many "close to the metal"
>>>> applications, such as embedded code and microcontrollers, OS code,
>>>> graphics, etc. ISTM that these are the areas (especially OS) that C was
>>>> designed for.
>>>
>>> I did and do spend significant portion of my time as sw developer in at least part of the above mentioned areas.
>>> And my experience is that it's not a case.
>>> I mean, both extraction from bit field to scalar and insertion of scalar into bit field are indeed not very rare.
>>> But copying of one bit field into another is extremely rare.
>> Oh, I agree with that. But once you have the "syntactical sugar" of
>> pseudo functions for extraction and insertion, the copying is just there
>> for free.
>
> But both for extraction to scalar and for insertion from scalar what Tim said is true - doing them with shifts and masks is easy and not error-prone.
> Pay attention that "extraction to scalar" and "insertion from scalar" implies that the bit field is no wider than widest scalar [integer] data type of a given machine, which is already quite significant simplification.

But if the starting bit number and length are variables, not explicit
constants, you might want to have code that checks for "legality" of the
values.

--
- Stephen Fuld
(e-mail address disguised to prevent spam)

Re: Dense machine code from C++ code (compiler optimizations)

<jwv1r1xbtb9.fsf-monnier+comp.arch@gnu.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22505&group=comp.arch#22505

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: monn...@iro.umontreal.ca (Stefan Monnier)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 17:02:44 -0500
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <jwv1r1xbtb9.fsf-monnier+comp.arch@gnu.org>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
<86r19yzby6.fsf@linuxsc.com> <sqd1hs$l2h$2@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="ff231636d4a4bdf362a9d3992bc0e63a";
logging-data="1359"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2I7YNHwwO86f/GHqUZC0W"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Cancel-Lock: sha1:TT0Berba/Gscf6xJdRQNQHZqIRM=
sha1:WriGJT6++9OlNlZ/bB4SNLMp8rc=
 by: Stefan Monnier - Mon, 27 Dec 2021 22:02 UTC

> Would you ban file I/O because there are lots of useful programs
> which only use standard input and standart output?

Maybe the argument goes that file I/O should not be part of the
language, but part of the library ;-)

Stefan

Re: Dense machine code from C++ code (compiler optimizations)

<sqddru$urp$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22506&group=comp.arch#22506

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.de!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-eb03-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 22:14:22 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <sqddru$urp$1@newsreader4.netcologne.de>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
<86r19yzby6.fsf@linuxsc.com> <sqd1hs$l2h$2@newsreader4.netcologne.de>
<jwv1r1xbtb9.fsf-monnier+comp.arch@gnu.org>
Injection-Date: Mon, 27 Dec 2021 22:14:22 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-eb03-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:eb03:0:7285:c2ff:fe6c:992d";
logging-data="31609"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 27 Dec 2021 22:14 UTC

Stefan Monnier <monnier@iro.umontreal.ca> schrieb:
>> Would you ban file I/O because there are lots of useful programs
>> which only use standard input and standart output?
>
> Maybe the argument goes that file I/O should not be part of the
> language, but part of the library ;-)

That is not really the case for C anymore. The library is very
much part of the language now, as you will discover if you try to
use reserved names for anything else.

Example:

#include <stdio.h>

double cos(double x)
{ return 3*x;
}

int main()
{ double a = -0.1;
printf ("%f\n", 1+cos(-a));
}

What will this print, both with gcc and with clang?

Re: Dense machine code from C++ code (compiler optimizations)

<sqddvu$urp$2@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22507&group=comp.arch#22507

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-eb03-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Dense machine code from C++ code (compiler optimizations)
Date: Mon, 27 Dec 2021 22:16:30 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <sqddvu$urp$2@newsreader4.netcologne.de>
References: <sndun6$q07$1@dont-email.me>
<dc10dfff-b48e-40ec-8c24-0a6c2e1790d2n@googlegroups.com>
<sphe6s$5a3$1@newsreader4.netcologne.de> <spqc1d$oio$1@dont-email.me>
<spqhj2$gdf$1@dont-email.me> <spqkjk$7ug$1@dont-email.me>
<86mtks1j79.fsf@linuxsc.com> <sq2acu$hg3$1@dont-email.me>
<86r19yzby6.fsf@linuxsc.com> <sqd262$459$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 27 Dec 2021 22:16:30 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-eb03-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:eb03:0:7285:c2ff:fe6c:992d";
logging-data="31609"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 27 Dec 2021 22:16 UTC

Guillaume <message@bottle.org> schrieb:
> Le 27/12/2021 à 09:30, Tim Rentsch a écrit :
>> The idea that feature X should be added to a language standard
>> just for the sake of commonality leads inexorably to a language
>> overloaded with features that are used only rarely.
>
> Yes. And isn't that what C++ exactly is? =)
> (Yes, it's a mess, but it might not be politically correct to say this.)

What C++ suffers from isn't feature creep. It's a feature stampede.

Pages:12345678
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor