Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The first version always gets thrown away.


devel / comp.lang.c++ / Re: overengineered

SubjectAuthor
* overengineeredBonita Montero
`* Re: overengineeredRoss Finlayson
 `* Re: overengineeredBonita Montero
  `* Re: overengineeredChris M. Thomasson
   `- Re: overengineeredBonita Montero

1
overengineered

<v0lq4h$1483o$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: overengineered
Date: Sun, 28 Apr 2024 17:31:29 +0200
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <v0lq4h$1483o$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 28 Apr 2024 17:31:29 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="7b71e943e08bab7b984b48dff94e6881";
logging-data="1187960"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EmdcLL47lxbMakYYz0tHEzlLdT72SxjA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Rm9/uccE5Ff8J7oHQDFk3Sz+GT4=
Content-Language: de-DE
 by: Bonita Montero - Sun, 28 Apr 2024 15:31 UTC

This is just overengineered ?

#include <iostream>
#include <intrin.h>

using namespace std;

int main()
{ struct feature_t
{
uint8_t id, leaf;
uint8_t reg, bit;
string_view descr;
};
enum { EAX, EBX, ECX, EDX };
static feature_t const features[] =
{
{ 7, 0, EBX, 16, "AVX512F" },
{ 7, 0, EBX, 17, "AVX512DQ" },
{ 7, 0, EBX, 21, "AVX512IFMA" },
{ 7, 0, EBX, 26, "AVX512PF" },
{ 7, 0, EBX, 27, "AVX512ER" },
{ 7, 0, EBX, 28, "AVX512CD" },
{ 7, 0, EBX, 30, "AVX512BW" },
{ 7, 0, EBX, 31, "AVX512VL" },
{ 7, 0, ECX, 0, "AVX512_VBMI" },
{ 7, 0, ECX, 6, "AVX512_VBMI2" },
{ 7, 0, ECX, 11, "AVX512_VNNI" },
{ 7, 0, ECX, 12, "AVX512_BITALG" },
{ 7, 0, ECX, 14, "AVX512_VPOPCNTDQ" },
{ 7, 0, EDX, 2, "AVX512_4VNNIW" },
{ 7, 0, EDX, 3, "AVX512_4FMAPS" },
{ 7, 0, EDX, 8, "AVX512_VP2INTERSECT" },
{ 7, 0, EDX, 23, "AVX512_FP16" },
{ 7, 1, EAX, 5, "AVX512_BF16" }
};
auto enumerate = [&]<typename Fn>( Fn fn )
requires requires( Fn fn, feature_t const &ft ) { { fn( ft ) }; }
{
int regs[4];
for( feature_t const *ftLast = nullptr; feature_t const &ft : features )
{
if( !ftLast || ft.id != ftLast->id || ft.leaf != ftLast->leaf )
__cpuidex( regs, ft.id, ft.leaf );
if( regs[ft.reg] >> ft.bit & 1 )
fn( ft );
ftLast = &ft;
}
};
size_t n = 0;
enumerate( [&]( feature_t const &ft ) { n += (size_t)(bool)n * 2 +
ft.descr.length(); } );
string strFt;
strFt.reserve( n );
enumerate( [&]( feature_t const &ft )
{
if( strFt.size() )
strFt += ", ";
strFt += ft.descr;
} );
cout << strFt << endl;
}

I could have used /proc/cpuinfo also.

Re: overengineered

<zjKdnfXi36nTBrP7nZ2dnZfqnPWdnZ2d@giganews.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder9.news.weretis.net!border-1.nntp.ord.giganews.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 28 Apr 2024 18:54:05 +0000
Subject: Re: overengineered
Newsgroups: comp.lang.c++
References: <v0lq4h$1483o$1@raubtier-asyl.eternal-september.org>
From: ross.a.f...@gmail.com (Ross Finlayson)
Date: Sun, 28 Apr 2024 11:54:11 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <v0lq4h$1483o$1@raubtier-asyl.eternal-september.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <zjKdnfXi36nTBrP7nZ2dnZfqnPWdnZ2d@giganews.com>
Lines: 91
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-9vJaVsGNMdYp9whxDxXRW52/2em2o1KeQXjcEjlboWYaQiU5FNVR/qcDvVZX4XEgicCE7xDYGaG9CVP!KEjrlKRPP54IOw7jHdNNWpigeDil/4X0BAhsUUb4gxosRBNrjcQ1Uhv/OWEbgTKLWFIDdj0kJog=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Ross Finlayson - Sun, 28 Apr 2024 18:54 UTC

On 04/28/2024 08:31 AM, Bonita Montero wrote:
> This is just overengineered ?
>
> #include <iostream>
> #include <intrin.h>
>
> using namespace std;
>
> int main()
> {
> struct feature_t
> {
> uint8_t id, leaf;
> uint8_t reg, bit;
> string_view descr;
> };
> enum { EAX, EBX, ECX, EDX };
> static feature_t const features[] =
> {
> { 7, 0, EBX, 16, "AVX512F" },
> { 7, 0, EBX, 17, "AVX512DQ" },
> { 7, 0, EBX, 21, "AVX512IFMA" },
> { 7, 0, EBX, 26, "AVX512PF" },
> { 7, 0, EBX, 27, "AVX512ER" },
> { 7, 0, EBX, 28, "AVX512CD" },
> { 7, 0, EBX, 30, "AVX512BW" },
> { 7, 0, EBX, 31, "AVX512VL" },
> { 7, 0, ECX, 0, "AVX512_VBMI" },
> { 7, 0, ECX, 6, "AVX512_VBMI2" },
> { 7, 0, ECX, 11, "AVX512_VNNI" },
> { 7, 0, ECX, 12, "AVX512_BITALG" },
> { 7, 0, ECX, 14, "AVX512_VPOPCNTDQ" },
> { 7, 0, EDX, 2, "AVX512_4VNNIW" },
> { 7, 0, EDX, 3, "AVX512_4FMAPS" },
> { 7, 0, EDX, 8, "AVX512_VP2INTERSECT" },
> { 7, 0, EDX, 23, "AVX512_FP16" },
> { 7, 1, EAX, 5, "AVX512_BF16" }
> };
> auto enumerate = [&]<typename Fn>( Fn fn )
> requires requires( Fn fn, feature_t const &ft ) { { fn( ft ) }; }
> {
> int regs[4];
> for( feature_t const *ftLast = nullptr; feature_t const &ft :
> features )
> {
> if( !ftLast || ft.id != ftLast->id || ft.leaf !=
> ftLast->leaf )
> __cpuidex( regs, ft.id, ft.leaf );
> if( regs[ft.reg] >> ft.bit & 1 )
> fn( ft );
> ftLast = &ft;
> }
> };
> size_t n = 0;
> enumerate( [&]( feature_t const &ft ) { n += (size_t)(bool)n * 2 +
> ft.descr.length(); } );
> string strFt;
> strFt.reserve( n );
> enumerate( [&]( feature_t const &ft )
> {
> if( strFt.size() )
> strFt += ", ";
> strFt += ft.descr;
> } );
> cout << strFt << endl;
> }
>
> I could have used /proc/cpuinfo also.

(Could you name ftLast to ftPrev instead pls. Also "(size_t)(bool)n"
seems "(n > 0 ? 1 : 0)", or, you know, I suppose. Then it would seem so
regular and conventional and idiomatic as to not seem over-engineered,
particularly as it's standard in libraries where the worst
sort of "over-engineered" seems "import world". Don't get me wrong,
I'm a big fan of over-engineering, especially when it results a clean,
factorized, composable design. The idea of comma-join is
a totally usual sort of thing in joining and splitting, about
things like "bool first" above loops "if (!first)" and all these kinds
things. Sometimes if/else in loops seems making for "(expr) &&
continue", or what are loop invariants and entry/exit automatics,
yet then it starts looking like shell scripting.

Is it, is it not-over-engineered? Implicits in the functions,
implicits in the loops, implicits in the routines,
all standard in only library functions, ...,
functional and procedural styles together. It could be
written all functional, or written all procedural,
flow-of-control is a deliberately didactic determinism.)

Re: overengineered

<v0n902$1i09f$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: overengineered
Date: Mon, 29 Apr 2024 06:51:15 +0200
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <v0n902$1i09f$1@raubtier-asyl.eternal-september.org>
References: <v0lq4h$1483o$1@raubtier-asyl.eternal-september.org>
<zjKdnfXi36nTBrP7nZ2dnZfqnPWdnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 29 Apr 2024 06:51:14 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="b3e0222ff44d0afec582eb4b43563aba";
logging-data="1638703"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dqSvFg3cJ/WyFS17Q5X20NySuy79qujU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wdFNjcDuQCQEeSUTm//nTzWXXFk=
In-Reply-To: <zjKdnfXi36nTBrP7nZ2dnZfqnPWdnZ2d@giganews.com>
Content-Language: de-DE
 by: Bonita Montero - Mon, 29 Apr 2024 04:51 UTC

Am 28.04.2024 um 20:54 schrieb Ross Finlayson:

> (Could you name ftLast to ftPrev instead pls. Also "(size_t)(bool)n"
> seems "(n > 0 ? 1 : 0)", or, you know, I suppose. ...

It's just my style, not yours.

Re: overengineered

<v0p0g8$1uq4v$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: overengineered
Date: Mon, 29 Apr 2024 13:38:32 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <v0p0g8$1uq4v$3@dont-email.me>
References: <v0lq4h$1483o$1@raubtier-asyl.eternal-september.org>
<zjKdnfXi36nTBrP7nZ2dnZfqnPWdnZ2d@giganews.com>
<v0n902$1i09f$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 29 Apr 2024 22:38:33 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="68a1f8b2290ba520f984bb7e7fb4eebe";
logging-data="2058399"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18YLO0/3HQ/ICeME25xnX1AKvGehaEQ3IY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:c0MZ/uokR4SCqReOUjz9A3XFsiA=
Content-Language: en-US
In-Reply-To: <v0n902$1i09f$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Mon, 29 Apr 2024 20:38 UTC

On 4/28/2024 9:51 PM, Bonita Montero wrote:
> Am 28.04.2024 um 20:54 schrieb Ross Finlayson:
>
>> (Could you name ftLast to ftPrev instead pls. Also "(size_t)(bool)n"
>> seems "(n > 0 ? 1 : 0)", or, you know, I suppose. ...
>
> It's just my style, not yours.
>
>

Sometimes, your style makes blood want to shoot out of my eyes!

;^)

Re: overengineered

<v1akht$2iqg0$2@raubtier-asyl.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: overengineered
Date: Mon, 6 May 2024 15:05:04 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <v1akht$2iqg0$2@raubtier-asyl.eternal-september.org>
References: <v0lq4h$1483o$1@raubtier-asyl.eternal-september.org>
<zjKdnfXi36nTBrP7nZ2dnZfqnPWdnZ2d@giganews.com>
<v0n902$1i09f$1@raubtier-asyl.eternal-september.org>
<v0p0g8$1uq4v$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 06 May 2024 15:05:01 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="e06fe4b76d6897bf55db3e92b14fce2d";
logging-data="2714112"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19iduz2w0LijIBlN5v0kNDHqj4KCq0twYo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:uvDbzwmX8UyoRda4P6JI+IPGBAg=
In-Reply-To: <v0p0g8$1uq4v$3@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Mon, 6 May 2024 13:05 UTC

Am 29.04.2024 um 22:38 schrieb Chris M. Thomasson:
> On 4/28/2024 9:51 PM, Bonita Montero wrote:
>> Am 28.04.2024 um 20:54 schrieb Ross Finlayson:
>>
>>> (Could you name ftLast to ftPrev instead pls. Also "(size_t)(bool)n"
>>> seems "(n > 0 ? 1 : 0)", or, you know, I suppose. ...
>>
>> It's just my style, not yours.
>>
>>
>
> Sometimes, your style makes blood want to shoot out of my eyes!
>
> ;^)

I love my style, mostly the srtong affinity
to functional programming in C++.


devel / comp.lang.c++ / Re: overengineered

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor