Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth


devel / comp.lang.c / Re: pointers are evil (mostly)

SubjectAuthor
* pointers are evil (mostly)fir
+- Re: pointers are evil (mostly)fir
+* Re: pointers are evil (mostly)Ed Prochak
|+* Re: pointers are evil (mostly)fir
||`* Re: pointers are evil (mostly)Ed Prochak
|| +* Re: pointers are evil (mostly)James Kuyper
|| |+* Re: pointers are evil (mostly)fir
|| ||`* Re: pointers are evil (mostly)Ed Prochak
|| || `* Re: pointers are evil (mostly)fir
|| ||  `* Re: pointers are evil (mostly)fir
|| ||   +* Re: pointers are evil (mostly)fir
|| ||   |`* Re: pointers are evil (mostly)Ed Prochak
|| ||   | `* Re: pointers are evil (mostly)Anton Shepelev
|| ||   |  `* Re: pointers are evil (mostly)olcott
|| ||   |   +* Re: pointers are evil (mostly)Vir Campestris
|| ||   |   |`- Re: pointers are evil (mostly)olcott
|| ||   |   `* Re: pointers are evil (mostly)Ed Prochak
|| ||   |    `* Re: pointers are evil (mostly)olcott
|| ||   |     +* Re: pointers are evil (mostly)jak.
|| ||   |     |`- Re: pointers are evil (mostly)Ed Prochak
|| ||   |     `* Re: pointers are evil (mostly)Ed Prochak
|| ||   |      +- Re: pointers are evil (mostly)olcott
|| ||   |      +* Re: pointers are evil (mostly)jak.
|| ||   |      |`* Re: pointers are evil (mostly)olcott
|| ||   |      | +- Re: pointers are evil (mostly)jak
|| ||   |      | `- Re: pointers are evil (mostly)jak
|| ||   |      `- Re: pointers are evil (mostly)Vir Campestris
|| ||   `- Re: pointers are evil (mostly)Ed Prochak
|| |`- Re: pointers are evil (mostly)Ed Prochak
|| `* Re: pointers are evil (mostly)Scott Lurndal
||  `- Re: pointers are evil (mostly)Ed Prochak
|`* Re: pointers are evil (mostly)James Kuyper
| +- Re: pointers are evil (mostly)Kaz Kylheku
| +* Re: pointers are evil (mostly)David Brown
| |+- Re: pointers are evil (mostly)James Kuyper
| |`- Re: pointers are evil (mostly)James Kuyper
| `- Re: pointers are evil (mostly)Ed Prochak
`- Re: pointers are evil (mostly)Bonita Montero

Pages:12
pointers are evil (mostly)

<41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ae9:eb85:0:b0:71f:b8e9:362e with SMTP id b127-20020ae9eb85000000b0071fb8e9362emr784175qkg.10.1676851978607;
Sun, 19 Feb 2023 16:12:58 -0800 (PST)
X-Received: by 2002:a81:5a88:0:b0:52a:bc4b:a3e with SMTP id
o130-20020a815a88000000b0052abc4b0a3emr925802ywb.459.1676851978380; Sun, 19
Feb 2023 16:12:58 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 19 Feb 2023 16:12:58 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.73; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.73
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
Subject: pointers are evil (mostly)
From: profesor...@gmail.com (fir)
Injection-Date: Mon, 20 Feb 2023 00:12:58 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2079
 by: fir - Mon, 20 Feb 2023 00:12 UTC

in history of c there are some syayemants like goto is evil, global variable accesses (some of them i mean more linke non -streamlined writes toi small global variables) are evil, and more

i was already writin on that somewhat but sometimes i just notice some
somewhat new 'take' on things (like seing some previos statements a bit more generally etc) and its maybe worth mentioning

pointers inded i find evil

in c when you got things like that

int a = 3;
int foo() {}
int tab[100];

a,foo,tab are adresses and its fully okay.. each of this thing lays somewhere in ram takes place and has its adress - and this is good thing

if you then make

int& tab_p = tab;

then its something like writing to local variable or abusing gotos,
it is asking yourself for trouble

and thats mostly it, what i want to say at the moment on this ..
people should rather avoid breaking 1-1 correspondence (of adres and ram) - its maybe not such bat do have n-1 correspondence but making those adresses pointers and make them probe to change its containing values making space for 'desynchronisation'

Re: pointers are evil (mostly)

<0c7509e3-ce6e-4e37-abbe-bdcca285bbfcn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a0c:dc14:0:b0:56e:afb9:d58d with SMTP id s20-20020a0cdc14000000b0056eafb9d58dmr204109qvk.34.1676906564937;
Mon, 20 Feb 2023 07:22:44 -0800 (PST)
X-Received: by 2002:a25:9f82:0:b0:92d:da08:ac3f with SMTP id
u2-20020a259f82000000b0092dda08ac3fmr1679476ybq.279.1676906564682; Mon, 20
Feb 2023 07:22:44 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 20 Feb 2023 07:22:44 -0800 (PST)
In-Reply-To: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.104; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.104
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0c7509e3-ce6e-4e37-abbe-bdcca285bbfcn@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: profesor...@gmail.com (fir)
Injection-Date: Mon, 20 Feb 2023 15:22:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1529
 by: fir - Mon, 20 Feb 2023 15:22 UTC

poniedziałek, 20 lutego 2023 o 01:13:05 UTC+1 fir napisał(a):
>
> if you then make
>
> int& tab_p = tab;
>
i menat ofc int* tab_p = tab;

> then its something like writing to local variable or abusing gotos,
> it is asking yourself for trouble
>
> and thats mostly it, what i want to say at the moment on this ..

Re: pointers are evil (mostly)

<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a0c:e004:0:b0:56e:a791:3a2d with SMTP id j4-20020a0ce004000000b0056ea7913a2dmr1434027qvk.31.1677084877408;
Wed, 22 Feb 2023 08:54:37 -0800 (PST)
X-Received: by 2002:a0d:d68b:0:b0:514:dae0:21ef with SMTP id
y133-20020a0dd68b000000b00514dae021efmr78489ywd.133.1677084877103; Wed, 22
Feb 2023 08:54:37 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 22 Feb 2023 08:54:36 -0800 (PST)
In-Reply-To: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:71ce:ffc5:fe82:26ec;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:71ce:ffc5:fe82:26ec
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Wed, 22 Feb 2023 16:54:37 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3343
 by: Ed Prochak - Wed, 22 Feb 2023 16:54 UTC

On Sunday, February 19, 2023 at 7:13:05 PM UTC-5, fir wrote:
> in history of c there are some syayemants like goto is evil,

No, it is the unrestricted use of GOTO is EVIL.

> global variable accesses (some of them i mean more linke non -streamlined writes toi small global variables) are evil, and more
>
> i was already writin on that somewhat but sometimes i just notice some
> somewhat new 'take' on things (like seing some previos statements a bit more generally etc)
> and its maybe worth mentioning
>
> pointers inded i find evil

I suspect you me the unrestricted use of pointers.
>
> in c when you got things like that
>
> int a = 3;
> int foo() {}
> int tab[100];
>
> a,foo,tab are adresses and its fully okay.. each of this thing lays somewhere in ram takes place and has its adress - and this is good thing
>
> if you then make
>
> int& tab_p = tab;
>
> then its something like writing to local variable or abusing gotos,
> it is asking yourself for trouble

No, it isn't.
And I see you corrected the statement later to

int *tab_p = tab;

>
> and thats mostly it, what i want to say at the moment on this ..
> people should rather avoid breaking 1-1 correspondence (of adres and ram)

Dropping pointers means dropping linked lists, trees and other data structures.

> - its maybe not such bat do have n-1 correspondence but making those adresses
> pointers and make them probe to change its containing values making space for 'desynchronisation'

But this is necessary in some cases. C is a language designed for systems level programs.
Writing a device driver may require addressing fixed memory locations (absolute address)
and there are situations where that address may change! This is an extreme but real example.

C programming does place great power in the programmer's hands.

You may want to to review the principles of structured programming.

Any programming language has features that can be abused.
C is no standout in this regard. IOW it is neither worse or better than other languages,
though the obfuscated C contest elevates the abuse to an art form.

Enjoy,
Ed

Re: pointers are evil (mostly)

<a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a0c:aad6:0:b0:56f:45d1:9ff8 with SMTP id g22-20020a0caad6000000b0056f45d19ff8mr1493344qvb.41.1677088654045;
Wed, 22 Feb 2023 09:57:34 -0800 (PST)
X-Received: by 2002:a25:9304:0:b0:879:9848:ea66 with SMTP id
f4-20020a259304000000b008799848ea66mr1693695ybo.133.1677088653815; Wed, 22
Feb 2023 09:57:33 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 22 Feb 2023 09:57:33 -0800 (PST)
In-Reply-To: <0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.140; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.140
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com> <0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: profesor...@gmail.com (fir)
Injection-Date: Wed, 22 Feb 2023 17:57:34 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3834
 by: fir - Wed, 22 Feb 2023 17:57 UTC

środa, 22 lutego 2023 o 17:54:44 UTC+1 Ed Prochak napisał(a):
> On Sunday, February 19, 2023 at 7:13:05 PM UTC-5, fir wrote:
> > in history of c there are some syayemants like goto is evil,
> No, it is the unrestricted use of GOTO is EVIL.
> > global variable accesses (some of them i mean more linke non -streamlined writes toi small global variables) are evil, and more
> >
> > i was already writin on that somewhat but sometimes i just notice some
> > somewhat new 'take' on things (like seing some previos statements a bit more generally etc)
> > and its maybe worth mentioning
> >
> > pointers inded i find evil
> I suspect you me the unrestricted use of pointers.
> >
> > in c when you got things like that
> >
> > int a = 3;
> > int foo() {}
> > int tab[100];
> >
> > a,foo,tab are adresses and its fully okay.. each of this thing lays somewhere in ram takes place and has its adress - and this is good thing
> >
> > if you then make
> >
> > int& tab_p = tab;
> >
> > then its something like writing to local variable or abusing gotos,
> > it is asking yourself for trouble
> No, it isn't.
> And I see you corrected the statement later to
>
> int *tab_p = tab;
> >
> > and thats mostly it, what i want to say at the moment on this ..
> > people should rather avoid breaking 1-1 correspondence (of adres and ram)
> Dropping pointers means dropping linked lists, trees and other data structures.
> > - its maybe not such bat do have n-1 correspondence but making those adresses
> > pointers and make them probe to change its containing values making space for 'desynchronisation'
> But this is necessary in some cases. C is a language designed for systems level programs.
> Writing a device driver may require addressing fixed memory locations (absolute address)
> and there are situations where that address may change! This is an extreme but real example.
>
> C programming does place great power in the programmer's hands.
>
> You may want to to review the principles of structured programming.
>
> Any programming language has features that can be abused.
> C is no standout in this regard. IOW it is neither worse or better than other languages,
> though the obfuscated C contest elevates the abuse to an art form.
>

well pointers are evin in some extent and about this it was this post...
its somewhat like with goto or global variables pointers are like goto or global variables

Re: pointers are evil (mostly)

<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:a07:b0:73b:a941:7206 with SMTP id i7-20020a05620a0a0700b0073ba9417206mr1596195qka.7.1677127074387;
Wed, 22 Feb 2023 20:37:54 -0800 (PST)
X-Received: by 2002:a81:b705:0:b0:530:a340:bcd7 with SMTP id
v5-20020a81b705000000b00530a340bcd7mr1673908ywh.8.1677127074155; Wed, 22 Feb
2023 20:37:54 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 22 Feb 2023 20:37:53 -0800 (PST)
In-Reply-To: <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:71ce:ffc5:fe82:26ec;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:71ce:ffc5:fe82:26ec
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Thu, 23 Feb 2023 04:37:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4611
 by: Ed Prochak - Thu, 23 Feb 2023 04:37 UTC

On Wednesday, February 22, 2023 at 12:57:42 PM UTC-5, fir wrote:
> środa, 22 lutego 2023 o 17:54:44 UTC+1 Ed Prochak napisał(a):
> > On Sunday, February 19, 2023 at 7:13:05 PM UTC-5, fir wrote:
> > > in history of c there are some syayemants like goto is evil,
> > No, it is the unrestricted use of GOTO is EVIL.
> > > global variable accesses (some of them i mean more linke non -streamlined writes toi small global variables) are evil, and more
> > >
> > > i was already writin on that somewhat but sometimes i just notice some
> > > somewhat new 'take' on things (like seing some previos statements a bit more generally etc)
> > > and its maybe worth mentioning
> > >
> > > pointers inded i find evil
> > I suspect you me the unrestricted use of pointers.
Ed correction: I suspect you mean the unrestricted use of pointers.
[]
> > > int& tab_p = tab;
> > >
> > > then its something like writing to local variable or abusing gotos,
> > > it is asking yourself for trouble
[]
> > >
> > > and thats mostly it, what i want to say at the moment on this ..
> > > people should rather avoid breaking 1-1 correspondence (of adres and ram)

new comment on this original point:
With current major processors, there is no 1-1 correspondence (of address and ram).
Programs run from execution cache memory and data is read and written to data cache.

[]
> > > - its maybe not such bat do have n-1 correspondence but making those adresses
> > > pointers and make them probe to change its containing values making space for 'desynchronisation'

Now this is a good point but the root cause of memory synchronization problems
is not necessarily pointer variables. I suggest it is related to multi-threading,
different threads of execution in a shared address space. Programmers unaware
of synchronization algorithms and tools my have this issue.

> > But this is necessary in some cases. C is a language designed for systems level programs.
> > Writing a device driver may require addressing fixed memory locations (absolute address)
> > and there are situations where that address may change! This is an extreme but real example.
> >
> > C programming does place great power in the programmer's hands.
> >
> > You may want to to review the principles of structured programming.
> >
> > Any programming language has features that can be abused.
> > C is no standout in this regard. IOW it is neither worse or better than other languages,
> > though the obfuscated C contest elevates the abuse to an art form.
> >
> well pointers are evin in some extent and about this it was this post...
> its somewhat like with goto or global variables pointers are like goto or global variables

Again I suggest you review the principles of structured programming.
Or consider the saying: A bad workman that blames his tools.

Pointers, GOTO statements, and global variables are tools in the C language toolbox.

If you think those tools are dangerous, go use another language.
Try PERL 8^) or maybe APL!
Or are you a JAVA programmer trying to get attention?

Enjoy,
Ed

Re: pointers are evil (mostly)

<tt6rbr$1pkqc$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Wed, 22 Feb 2023 23:51:07 -0500
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <tt6rbr$1pkqc$1@dont-email.me>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
<a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 23 Feb 2023 04:51:07 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="dbcfaeb728651dc45440c6790218c30e";
logging-data="1889100"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ssC84YCGAhrSsyFSaiEPyVVpknMuGuUs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.7.1
Cancel-Lock: sha1:AGYe7v6t6a9jatEar59n7YBypQA=
In-Reply-To: <93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com>
Content-Language: en-US
 by: James Kuyper - Thu, 23 Feb 2023 04:51 UTC

On 2/22/23 23:37, Ed Prochak wrote:
....
> Or consider the saying: A bad workman that blames his tools.

I hate that saying, or more accurately, it's misuse to justify ignoring
all complaints about badly designed tools. Good workmen also blame their
tools, if they are in fact blameworthy - or do you claim that tools are
never worthy of blame?

Re: pointers are evil (mostly)

<tt6rdd$1pkqc$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Wed, 22 Feb 2023 23:51:57 -0500
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <tt6rdd$1pkqc$2@dont-email.me>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 23 Feb 2023 04:51:57 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="dbcfaeb728651dc45440c6790218c30e";
logging-data="1889100"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Kc3Kf8Jacp40hDe3OhKb7OXs3+ateI5s="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.7.1
Cancel-Lock: sha1:QIW7Tq8jbIuaWn1xqT/6fLE8goA=
Content-Language: en-US
In-Reply-To: <0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
 by: James Kuyper - Thu, 23 Feb 2023 04:51 UTC

On 2/22/23 11:54, Ed Prochak wrote:
....
> Dropping pointers means dropping linked lists, trees and other data structures.

No, it doesn't. Each of those structures can be implemented by saving
indices into arrays, rather than pointers. Instead of *next_ptr, you end
up writing node_list[next_idx]. I've experience with that kind of thing
in old Fortran programs. Pointers are a [great!] convenience, not a
necessity.

Re: pointers are evil (mostly)

<20230222230016.65@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Thu, 23 Feb 2023 07:03:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20230222230016.65@kylheku.com>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
<tt6rdd$1pkqc$2@dont-email.me>
Injection-Date: Thu, 23 Feb 2023 07:03:57 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="736dfad4d69e7782ddc1db28b631f444";
logging-data="1911375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18yjjL8b71twR8fMPBJg9K1e1sZcmaMtJ0="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:xb6f1kXOS0wpyuheu3uSYq4PwNI=
 by: Kaz Kylheku - Thu, 23 Feb 2023 07:03 UTC

On 2023-02-23, James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
> On 2/22/23 11:54, Ed Prochak wrote:
> ...
>> Dropping pointers means dropping linked lists, trees and other data structures.
>
> No, it doesn't. Each of those structures can be implemented by saving
> indices into arrays, rather than pointers.

Not only that, but also using aggregate values that have reference
semantics. These are kind of pointers, but they can be managed (e.g.
garbage collection) and prevented from misuse (no casting to another
type, or arithmetic).

> Instead of *next_ptr, you end
> up writing node_list[next_idx]. I've experience with that kind of thing
> in old Fortran programs. Pointers are a [great!] convenience, not a
> necessity.

I wrote a balanced binary search tree that way in John E. Davis's S-lang,
back around 1996. A team at Nortel had integrated S-lang into production
use, and in that project I had to solve a problem that needed the S-lang
code to have halfway efficient dictionary structure.

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

Re: pointers are evil (mostly)

<tt78kq$1qpmh$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Thu, 23 Feb 2023 09:37:46 +0100
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <tt78kq$1qpmh$1@dont-email.me>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
<tt6rdd$1pkqc$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 23 Feb 2023 08:37:46 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="ac0740ed7cf9ce05be2da7ccd8e1166a";
logging-data="1926865"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19c+Ut+JgCOIzOTzbroomTs5RYoYQwtUY0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:QsT58l4sNljMDK6cRtHB1Kk+HLI=
Content-Language: en-GB
In-Reply-To: <tt6rdd$1pkqc$2@dont-email.me>
 by: David Brown - Thu, 23 Feb 2023 08:37 UTC

On 23/02/2023 05:51, James Kuyper wrote:
> On 2/22/23 11:54, Ed Prochak wrote:
> ...
>> Dropping pointers means dropping linked lists, trees and other data structures.
>
> No, it doesn't. Each of those structures can be implemented by saving
> indices into arrays, rather than pointers. Instead of *next_ptr, you end
> up writing node_list[next_idx]. I've experience with that kind of thing
> in old Fortran programs. Pointers are a [great!] convenience, not a
> necessity.
>

Such indices are pointers too, in a more general sense. In C, the term
"pointer" almost always refers to a simple "memory address" pointer.
But in other contexts, including C++, "pointer" can be refer to other
types of indirect references (including "smart pointers").

But it is also possible to implement data structures without any
explicit pointers or pointer equivalent, where the details are hidden by
the language. You don't see pointers at all in Python or Haskell, but
can quite happily have lists, trees, and other structures.

Re: pointers are evil (mostly)

<pcMJL.1159046$iS99.1049123@fx16.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx16.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: pointers are evil (mostly)
Newsgroups: comp.lang.c
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com> <0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com> <93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com>
Lines: 25
Message-ID: <pcMJL.1159046$iS99.1049123@fx16.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Thu, 23 Feb 2023 16:08:53 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Thu, 23 Feb 2023 16:08:53 GMT
X-Received-Bytes: 1805
 by: Scott Lurndal - Thu, 23 Feb 2023 16:08 UTC

Ed Prochak <edprochak@gmail.com> writes:
>On Wednesday, February 22, 2023 at 12:57:42 PM UTC-5, fir wrote:

>> > > and thats mostly it, what i want to say at the moment on this ..=20
>> > > people should rather avoid breaking 1-1 correspondence (of adres and =
>ram)=20
>
>new comment on this original point:
>With current major processors, there is no 1-1 correspondence (of address a=
>nd ram).
>Programs run from execution cache memory and data is read and written to da=
>ta cache.

That's not a particularly accurate or useful description of how the
memory subsystem works on a modern processor. Caches use the same
physical addresses as RAM (leaving aside the rare virtually indexed
cache, which even then is still physically tagged) and aside from
some transient data, cached data will flushed to RAM as necessary.

All modern processors allow the caches to be disabled for some or
all of the physical address space (MTRR, MAIR, etc).

Aside from bare-metal code, C program pointers are virtual
addresses anyway.

Re: pointers are evil (mostly)

<tt83l9$1tj6i$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Thu, 23 Feb 2023 11:18:48 -0500
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <tt83l9$1tj6i$2@dont-email.me>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
<tt6rdd$1pkqc$2@dont-email.me> <tt78kq$1qpmh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 23 Feb 2023 16:18:49 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="dbcfaeb728651dc45440c6790218c30e";
logging-data="2018514"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18e6VkbgVCFenQ+9wQWM0w+BhOePws4dAk="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.7.1
Cancel-Lock: sha1:Ur2Q+pzOGbeOUFcBiIn+zY3zvG8=
Content-Language: en-US
In-Reply-To: <tt78kq$1qpmh$1@dont-email.me>
 by: James Kuyper - Thu, 23 Feb 2023 16:18 UTC

On 2/23/23 03:37, David Brown wrote:
> On 23/02/2023 05:51, James Kuyper wrote:
>> On 2/22/23 11:54, Ed Prochak wrote:
>> ...
>>> Dropping pointers means dropping linked lists, trees and other data
>>> structures.
>>
>> No, it doesn't. Each of those structures can be implemented by saving
>> indices into arrays, rather than pointers. Instead of *next_ptr, you end
>> up writing node_list[next_idx]. I've experience with that kind of thing
>> in old Fortran programs. Pointers are a [great!] convenience, not a
>> necessity.
>>
>
> Such indices are pointers too, in a more general sense. In C, the term
> "pointer" almost always refers to a simple "memory address" pointer.
> But in other contexts, including C++, "pointer" can be refer to other
> types of indirect references (including "smart pointers").

Perhaps, but they don't need to have the features that make pointers
dangerous. I've used languages where accessing an array outside of it's
range had well-defined behavior (in some of them, array[i] refers to the
first element of the array if i is too small, and it refers to the last
element of the array if i is too big - and I've even seen a program
targeting one such implementation that relied upon that feature to
simplify the logic),

Re: pointers are evil (mostly)

<tt9nne$24rgn$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Fri, 24 Feb 2023 02:07:26 -0500
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <tt9nne$24rgn$1@dont-email.me>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
<tt6rdd$1pkqc$2@dont-email.me> <tt78kq$1qpmh$1@dont-email.me>
<tt83b4$1tj6i$1@dont-email.me>
<17468aaaa4dd4d1d$189$406094$7aa12cbf@news.newsdemon.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Feb 2023 07:07:26 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="e6e9541716af4b1388f5ef64fe60c32d";
logging-data="2256407"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jz56YQ14KEgyBi0pnXx7FbgnpAkLev/A="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.7.1
Cancel-Lock: sha1:z/9p9SDXVkvlOti7WOCWX60JFkQ=
In-Reply-To: <17468aaaa4dd4d1d$189$406094$7aa12cbf@news.newsdemon.com>
Content-Language: en-US
 by: James Kuyper - Fri, 24 Feb 2023 07:07 UTC

On 2/23/23 14:26, Mr Flibble wrote:
> On Thu, 23 Feb 2023 11:13:23 -0500, James Kuyper wrote:
....
>> Perhaps, but they don't need to have the features that make pointers
>> dangerous. I've used languages where accessing an array outside of it's
>> range had well-defined behavior (in some of them, array[i] refers to the
>> first element of the array if i is too small, and it refers to the last
>> element of the array if i is too big - and I've even seen a program
>> targeting one such implementation that relied upon that feature to
>> simplify the logic),
>
> Bullshit.
>
> /Flibble

Are you denying the existence of such languages? IDL is one of them. I
can't remember the others - they must be ones I didn't make much use of,
I just remember this one way in which they were significantly different
from any other language I've ever learned.

Re: pointers are evil (mostly)

<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ad4:4f90:0:b0:56f:3aef:1633 with SMTP id em16-20020ad44f90000000b0056f3aef1633mr3128867qvb.1.1677286704402;
Fri, 24 Feb 2023 16:58:24 -0800 (PST)
X-Received: by 2002:a05:690c:1d:b0:521:daa4:d687 with SMTP id
bc29-20020a05690c001d00b00521daa4d687mr1377315ywb.0.1677286704116; Fri, 24
Feb 2023 16:58:24 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 24 Feb 2023 16:58:23 -0800 (PST)
In-Reply-To: <tt6rbr$1pkqc$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.79; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.79
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <tt6rbr$1pkqc$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: profesor...@gmail.com (fir)
Injection-Date: Sat, 25 Feb 2023 00:58:24 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2205
 by: fir - Sat, 25 Feb 2023 00:58 UTC

czwartek, 23 lutego 2023 o 05:51:21 UTC+1 James Kuyper napisał(a):
> On 2/22/23 23:37, Ed Prochak wrote:
> ...
> > Or consider the saying: A bad workman that blames his tools.
> I hate that saying, or more accurately, it's misuse to justify ignoring
> all complaints about badly designed tools. Good workmen also blame their
> tools, if they are in fact blameworthy - or do you claim that tools are
> never worthy of blame?

i dont blame tools.. what i say is rather that there are many people who sees a thing in c like pointer and they could have idea to use a lot of it...what i say that even aberage use of pointers is imo bad they should be sorta minimalised imo (roughly speaking, becous there is a neeed to judge it in cases)..also the overal reutation of pointers in c (as a language syub) is too high imo

Re: pointers are evil (mostly)

<d1a702c7-b517-4597-aa43-b643481f7313n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:1a0c:b0:3bf:a99f:474e with SMTP id f12-20020a05622a1a0c00b003bfa99f474emr2652682qtb.0.1677470603109;
Sun, 26 Feb 2023 20:03:23 -0800 (PST)
X-Received: by 2002:a81:4422:0:b0:52e:f66d:b70f with SMTP id
r34-20020a814422000000b0052ef66db70fmr9186806ywa.5.1677470602840; Sun, 26 Feb
2023 20:03:22 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 26 Feb 2023 20:03:22 -0800 (PST)
In-Reply-To: <tt6rbr$1pkqc$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:4076:8f0e:12a8:d639;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:4076:8f0e:12a8:d639
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <tt6rbr$1pkqc$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d1a702c7-b517-4597-aa43-b643481f7313n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Mon, 27 Feb 2023 04:03:23 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2782
 by: Ed Prochak - Mon, 27 Feb 2023 04:03 UTC

On Wednesday, February 22, 2023 at 11:51:21 PM UTC-5, James Kuyper wrote:
> On 2/22/23 23:37, Ed Prochak wrote:
> ...
> > Or consider the saying: A bad workman that blames his tools.
> I hate that saying, or more accurately, it's misuse to justify ignoring
> all complaints about badly designed tools. Good workmen also blame their
> tools, if they are in fact blameworthy - or do you claim that tools are
> never worthy of blame?

I have complained many times about bad tools over the span of my career.

In this context, decent software engineering workmen have correctly built
an enormous amount of correctly functioning software using C with its
"evil" pointers. And especially the amount of embedded and operating system
software for which the C language was designed demonstrates the usefulness
of this tool. So, it seems clear that C is a tool appropriate for the tasks for which
it was designed.

To continue the analogy, C is a power tool, and there have also been many less skilled
software engineers that have used it improperly and had poor results as a consequence.

I did not bring up that saying as a cheap shot or to call out anyone as a poor workman.
I was trying to jog fir out of the very limiting views that pointers, GOTO statements, and
global variables are inherently and always "evil".
Ed

Re: pointers are evil (mostly)

<4b47e3eb-a62f-44c5-82ab-88d24a668b21n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:1483:b0:742:83ee:f569 with SMTP id w3-20020a05620a148300b0074283eef569mr1075735qkj.13.1677470762782;
Sun, 26 Feb 2023 20:06:02 -0800 (PST)
X-Received: by 2002:a5b:34e:0:b0:a1e:deda:9c95 with SMTP id
q14-20020a5b034e000000b00a1ededa9c95mr7675689ybp.4.1677470762515; Sun, 26 Feb
2023 20:06:02 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 26 Feb 2023 20:06:02 -0800 (PST)
In-Reply-To: <tt6rdd$1pkqc$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:4076:8f0e:12a8:d639;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:4076:8f0e:12a8:d639
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <tt6rdd$1pkqc$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4b47e3eb-a62f-44c5-82ab-88d24a668b21n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Mon, 27 Feb 2023 04:06:02 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2196
 by: Ed Prochak - Mon, 27 Feb 2023 04:06 UTC

On Wednesday, February 22, 2023 at 11:52:11 PM UTC-5, James Kuyper wrote:
> On 2/22/23 11:54, Ed Prochak wrote:
> ...
> > Dropping pointers means dropping linked lists, trees and other data structures.
> No, it doesn't. Each of those structures can be implemented by saving
> indices into arrays, rather than pointers. Instead of *next_ptr, you end
> up writing node_list[next_idx]. I've experience with that kind of thing
> in old Fortran programs. Pointers are a [great!] convenience, not a
> necessity.

You are correct I did overstate the case.
But your solution merely replaced absolute addresses with relative ones.

If you want to program in FORTRAN, go ahead. (I did it for some years early
in my career.)

Try programming hardware device drivers, operating system, or just the
basic memory management needed to allocate your arrays without pointers.

Ed

Re: pointers are evil (mostly)

<7fc93bba-9460-45b0-a222-cb9f2e9afa39n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:8306:b0:742:b556:adb3 with SMTP id pa6-20020a05620a830600b00742b556adb3mr325626qkn.2.1677471274990;
Sun, 26 Feb 2023 20:14:34 -0800 (PST)
X-Received: by 2002:a25:938e:0:b0:a60:c167:c056 with SMTP id
a14-20020a25938e000000b00a60c167c056mr3746368ybm.9.1677471274723; Sun, 26 Feb
2023 20:14:34 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 26 Feb 2023 20:14:34 -0800 (PST)
In-Reply-To: <pcMJL.1159046$iS99.1049123@fx16.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:4076:8f0e:12a8:d639;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:4076:8f0e:12a8:d639
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <pcMJL.1159046$iS99.1049123@fx16.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7fc93bba-9460-45b0-a222-cb9f2e9afa39n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Mon, 27 Feb 2023 04:14:34 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2973
 by: Ed Prochak - Mon, 27 Feb 2023 04:14 UTC

On Thursday, February 23, 2023 at 11:09:06 AM UTC-5, Scott Lurndal wrote:
> Ed Prochak <edpr...@gmail.com> writes:
> >On Wednesday, February 22, 2023 at 12:57:42 PM UTC-5, fir wrote:
> >> > > and thats mostly it, what i want to say at the moment on this ..=20
> >> > > people should rather avoid breaking 1-1 correspondence (of adres and =
> >ram)=20
> >
> >new comment on this original point:
> >With current major processors, there is no 1-1 correspondence (of address a=
> >nd ram).
> >Programs run from execution cache memory and data is read and written to da=
> >ta cache.
>
> That's not a particularly accurate or useful description of how the
> memory subsystem works on a modern processor. Caches use the same
> physical addresses as RAM (leaving aside the rare virtually indexed
> cache, which even then is still physically tagged) and aside from
> some transient data, cached data will flushed to RAM as necessary.
>
> All modern processors allow the caches to be disabled for some or
> all of the physical address space (MTRR, MAIR, etc).
>
> Aside from bare-metal code, C program pointers are virtual
> addresses anyway.

Quite true.

But I thought the original complaint implied the old (ancient in internet time :^)
more direct modes of addressing without cache support hardware. I often think
of these discussions in an embedded software environment where I sometimes
need to point to a real hardware physical address.

Ed

Re: pointers are evil (mostly)

<a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:148e:b0:741:c182:d200 with SMTP id w14-20020a05620a148e00b00741c182d200mr4398580qkj.11.1677472440253;
Sun, 26 Feb 2023 20:34:00 -0800 (PST)
X-Received: by 2002:a5b:350:0:b0:a02:a3a6:7a67 with SMTP id
q16-20020a5b0350000000b00a02a3a67a67mr8222157ybp.11.1677472439885; Sun, 26
Feb 2023 20:33:59 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 26 Feb 2023 20:33:59 -0800 (PST)
In-Reply-To: <410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:4076:8f0e:12a8:d639;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:4076:8f0e:12a8:d639
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <tt6rbr$1pkqc$1@dont-email.me>
<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Mon, 27 Feb 2023 04:34:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3406
 by: Ed Prochak - Mon, 27 Feb 2023 04:33 UTC

On Friday, February 24, 2023 at 7:58:31 PM UTC-5, fir wrote:
> czwartek, 23 lutego 2023 o 05:51:21 UTC+1 James Kuyper napisał(a):
> > On 2/22/23 23:37, Ed Prochak wrote:
> > ...
> > > Or consider the saying: A bad workman that blames his tools.
> > I hate that saying, or more accurately, it's misuse to justify ignoring
> > all complaints about badly designed tools. Good workmen also blame their
> > tools, if they are in fact blameworthy - or do you claim that tools are
> > never worthy of blame?
> i dont blame tools.. what i say is rather that there are many people
> who sees a thing in c like pointer and they could have idea to use a lot of it.
> ..what i say that even aberage use of pointers is imo bad they should be sorta
> minimalised imo (roughly speaking, becous there is a neeed to judge it in cases)
> ..also the overal reutation of pointers in c (as a language syub) is too high imo

You are entitled to your opinion. You have a choice in what language to use to avoid
the "evil" you see in C programming. Go ahead any use JAVA.

But you have not made a strong case for eliminating pointers, GOTOs, or global variables
in the C programming language

Just because you have seen a feature abused is not justification to remove it from the language.
I have seen pointers abused in C. I have also seen other features of C abused. For example,
I've had to deal with an extended compound conditional expression in a while loop, specifically
a while() statement that was 7 lines long!

A better solution IMHO is conducting code reviews. More experienced senior engineers can
tell when an apparent abuse of a pointer might just be a clever optimization requiring just
a detailed explanation in the comments. Or when a seemingly simple use of a pointer might
truly be an abuse of the feature.

Ed

Re: pointers are evil (mostly)

<fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:704a:0:b0:3bf:e01e:490e with SMTP id y10-20020ac8704a000000b003bfe01e490emr413242qtm.11.1677553921085;
Mon, 27 Feb 2023 19:12:01 -0800 (PST)
X-Received: by 2002:a05:690c:1d:b0:521:daa4:d687 with SMTP id
bc29-20020a05690c001d00b00521daa4d687mr10084795ywb.0.1677553920759; Mon, 27
Feb 2023 19:12:00 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 27 Feb 2023 19:12:00 -0800 (PST)
In-Reply-To: <a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.65; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.65
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <tt6rbr$1pkqc$1@dont-email.me>
<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com> <a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: profesor...@gmail.com (fir)
Injection-Date: Tue, 28 Feb 2023 03:12:01 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4138
 by: fir - Tue, 28 Feb 2023 03:12 UTC

poniedziałek, 27 lutego 2023 o 05:34:07 UTC+1 Ed Prochak napisał(a):
> On Friday, February 24, 2023 at 7:58:31 PM UTC-5, fir wrote:
> > czwartek, 23 lutego 2023 o 05:51:21 UTC+1 James Kuyper napisał(a):
> > > On 2/22/23 23:37, Ed Prochak wrote:
> > > ...
> > > > Or consider the saying: A bad workman that blames his tools.
> > > I hate that saying, or more accurately, it's misuse to justify ignoring
> > > all complaints about badly designed tools. Good workmen also blame their
> > > tools, if they are in fact blameworthy - or do you claim that tools are
> > > never worthy of blame?
> > i dont blame tools.. what i say is rather that there are many people
> > who sees a thing in c like pointer and they could have idea to use a lot of it.
> > ..what i say that even aberage use of pointers is imo bad they should be sorta
> > minimalised imo (roughly speaking, becous there is a neeed to judge it in cases)
> > ..also the overal reutation of pointers in c (as a language syub) is too high imo
> You are entitled to your opinion. You have a choice in what language to use to avoid
> the "evil" you see in C programming. Go ahead any use JAVA.
>
> But you have not made a strong case for eliminating pointers, GOTOs, or global variables
> in the C programming language
>
> Just because you have seen a feature abused is not justification to remove it from the language.
> I have seen pointers abused in C. I have also seen other features of C abused. For example,
> I've had to deal with an extended compound conditional expression in a while loop, specifically
> a while() statement that was 7 lines long!
>
> A better solution IMHO is conducting code reviews. More experienced senior engineers can
> tell when an apparent abuse of a pointer might just be a clever optimization requiring just
> a detailed explanation in the comments. Or when a seemingly simple use of a pointer might
> truly be an abuse of the feature.
>
> Ed

well i dint see pointers abused (mostly becouse i very rarely read others people code, also i guess its hard to abuse pointers)

what i say is something other, its not quiote on usage of pointers by people but understanding its nature (and how it should be treated)

what i say that adresses are ok but pointers not quite

maybe some example for example allocating memory by mallooc
creates pointer and this is bad becouse pointer is evil, it would be better to create not a pointer but a name containing adress

Re: pointers are evil (mostly)

<622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:688f:0:b0:3bf:d1e1:aaf4 with SMTP id m15-20020ac8688f000000b003bfd1e1aaf4mr414520qtq.8.1677554356400;
Mon, 27 Feb 2023 19:19:16 -0800 (PST)
X-Received: by 2002:a05:6902:c7:b0:a02:a44e:585c with SMTP id
i7-20020a05690200c700b00a02a44e585cmr583883ybs.1.1677554355924; Mon, 27 Feb
2023 19:19:15 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 27 Feb 2023 19:19:15 -0800 (PST)
In-Reply-To: <fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.65; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.65
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <tt6rbr$1pkqc$1@dont-email.me>
<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com> <a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
<fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: profesor...@gmail.com (fir)
Injection-Date: Tue, 28 Feb 2023 03:19:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4855
 by: fir - Tue, 28 Feb 2023 03:19 UTC

wtorek, 28 lutego 2023 o 04:12:08 UTC+1 fir napisał(a):
> poniedziałek, 27 lutego 2023 o 05:34:07 UTC+1 Ed Prochak napisał(a):
> > On Friday, February 24, 2023 at 7:58:31 PM UTC-5, fir wrote:
> > > czwartek, 23 lutego 2023 o 05:51:21 UTC+1 James Kuyper napisał(a):
> > > > On 2/22/23 23:37, Ed Prochak wrote:
> > > > ...
> > > > > Or consider the saying: A bad workman that blames his tools.
> > > > I hate that saying, or more accurately, it's misuse to justify ignoring
> > > > all complaints about badly designed tools. Good workmen also blame their
> > > > tools, if they are in fact blameworthy - or do you claim that tools are
> > > > never worthy of blame?
> > > i dont blame tools.. what i say is rather that there are many people
> > > who sees a thing in c like pointer and they could have idea to use a lot of it.
> > > ..what i say that even aberage use of pointers is imo bad they should be sorta
> > > minimalised imo (roughly speaking, becous there is a neeed to judge it in cases)
> > > ..also the overal reutation of pointers in c (as a language syub) is too high imo
> > You are entitled to your opinion. You have a choice in what language to use to avoid
> > the "evil" you see in C programming. Go ahead any use JAVA.
> >
> > But you have not made a strong case for eliminating pointers, GOTOs, or global variables
> > in the C programming language
> >
> > Just because you have seen a feature abused is not justification to remove it from the language.
> > I have seen pointers abused in C. I have also seen other features of C abused. For example,
> > I've had to deal with an extended compound conditional expression in a while loop, specifically
> > a while() statement that was 7 lines long!
> >
> > A better solution IMHO is conducting code reviews. More experienced senior engineers can
> > tell when an apparent abuse of a pointer might just be a clever optimization requiring just
> > a detailed explanation in the comments. Or when a seemingly simple use of a pointer might
> > truly be an abuse of the feature.
> >
> > Ed
> well i dint see pointers abused (mostly becouse i very rarely read others people code, also i guess its hard to abuse pointers)
>
> what i say is something other, its not quiote on usage of pointers by people but understanding its nature (and how it should be treated)
>
> what i say that adresses are ok but pointers not quite
>
> maybe some example for example allocating memory by mallooc
> creates pointer and this is bad becouse pointer is evil, it would be better to create not a pointer but a name containing adress

so what iu was saying is more like highly theoretical, but has some practocal outcome in understanding/treating the languege

as to what i say here

int* buf = malloc(1000);

is evil becouse pointer is evil as i said
by coincidence you dont need buff to be a pointer you need it to be
an label (adress + name pair)

you dont need to change the pointer value etc

sou you would rather need

int buf[] = malloc(1000);

and here buf is not a pointer, note, it shouldnt be

Re: pointers are evil (mostly)

<e53b8493-b668-45e9-a13f-9cd7622d5e54n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:5396:0:b0:3bf:c38c:98ee with SMTP id x22-20020ac85396000000b003bfc38c98eemr1181443qtp.5.1677633697969;
Tue, 28 Feb 2023 17:21:37 -0800 (PST)
X-Received: by 2002:a5b:d0c:0:b0:9fe:1493:17ea with SMTP id
y12-20020a5b0d0c000000b009fe149317eamr2085655ybp.11.1677633697688; Tue, 28
Feb 2023 17:21:37 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 28 Feb 2023 17:21:37 -0800 (PST)
In-Reply-To: <622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.188; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.188
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <tt6rbr$1pkqc$1@dont-email.me>
<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com> <a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
<fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com> <622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e53b8493-b668-45e9-a13f-9cd7622d5e54n@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: profesor...@gmail.com (fir)
Injection-Date: Wed, 01 Mar 2023 01:21:37 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5848
 by: fir - Wed, 1 Mar 2023 01:21 UTC

wtorek, 28 lutego 2023 o 04:19:23 UTC+1 fir napisał(a):
> wtorek, 28 lutego 2023 o 04:12:08 UTC+1 fir napisał(a):
> > poniedziałek, 27 lutego 2023 o 05:34:07 UTC+1 Ed Prochak napisał(a):
> > > On Friday, February 24, 2023 at 7:58:31 PM UTC-5, fir wrote:
> > > > czwartek, 23 lutego 2023 o 05:51:21 UTC+1 James Kuyper napisał(a):
> > > > > On 2/22/23 23:37, Ed Prochak wrote:
> > > > > ...
> > > > > > Or consider the saying: A bad workman that blames his tools.
> > > > > I hate that saying, or more accurately, it's misuse to justify ignoring
> > > > > all complaints about badly designed tools. Good workmen also blame their
> > > > > tools, if they are in fact blameworthy - or do you claim that tools are
> > > > > never worthy of blame?
> > > > i dont blame tools.. what i say is rather that there are many people
> > > > who sees a thing in c like pointer and they could have idea to use a lot of it.
> > > > ..what i say that even aberage use of pointers is imo bad they should be sorta
> > > > minimalised imo (roughly speaking, becous there is a neeed to judge it in cases)
> > > > ..also the overal reutation of pointers in c (as a language syub) is too high imo
> > > You are entitled to your opinion. You have a choice in what language to use to avoid
> > > the "evil" you see in C programming. Go ahead any use JAVA.
> > >
> > > But you have not made a strong case for eliminating pointers, GOTOs, or global variables
> > > in the C programming language
> > >
> > > Just because you have seen a feature abused is not justification to remove it from the language.
> > > I have seen pointers abused in C. I have also seen other features of C abused. For example,
> > > I've had to deal with an extended compound conditional expression in a while loop, specifically
> > > a while() statement that was 7 lines long!
> > >
> > > A better solution IMHO is conducting code reviews. More experienced senior engineers can
> > > tell when an apparent abuse of a pointer might just be a clever optimization requiring just
> > > a detailed explanation in the comments. Or when a seemingly simple use of a pointer might
> > > truly be an abuse of the feature.
> > >
> > > Ed
> > well i dint see pointers abused (mostly becouse i very rarely read others people code, also i guess its hard to abuse pointers)
> >
> > what i say is something other, its not quiote on usage of pointers by people but understanding its nature (and how it should be treated)
> >
> > what i say that adresses are ok but pointers not quite
> >
> > maybe some example for example allocating memory by mallooc
> > creates pointer and this is bad becouse pointer is evil, it would be better to create not a pointer but a name containing adress
> so what iu was saying is more like highly theoretical, but has some practocal outcome in understanding/treating the languege
>
> as to what i say here
>
> int* buf = malloc(1000);
>
> is evil becouse pointer is evil as i said
> by coincidence you dont need buff to be a pointer you need it to be
> an label (adress + name pair)
>
> you dont need to change the pointer value etc
>
> sou you would rather need
>
> int buf[] = malloc(1000);
>
> and here buf is not a pointer, note, it shouldnt be

c also abuses that not only in mallock but in function
arguments

int print2(char* txt)
{ //you dont need here a pointer txt placet in its ram, to be able to change it etc, you only need and adress to read freoim it or eventually write under itt
}

in c nomenclature as i said i would rather write it
int print2(char txt[])
{ }

here txt is adres not a pointer (in my provate nomenclature
here txt is two adresses)

some also my see it as c++ reference
int print2(char& txt)
{ }

though i dilike c++ and there is no need to name it as reference
but notatiuon is ok in showing difference between char& (which is adress) and chat* wgich is pointer that is logical abuse

Re: pointers are evil (mostly)

<ttn65r$3tpds$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Wed, 1 Mar 2023 10:35:10 +0100
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <ttn65r$3tpds$1@dont-email.me>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 1 Mar 2023 09:33:47 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="46cf20bd397f6645170aec04bfd7d01b";
logging-data="4122044"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WBhLkR6TQJ/D2ud5ZOUI5yM8q6s2XTgw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.8.0
Cancel-Lock: sha1:FZA0xsjolSxEU1xTWihvquUzMVk=
In-Reply-To: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
Content-Language: de-DE
 by: Bonita Montero - Wed, 1 Mar 2023 09:35 UTC

Am 20.02.2023 um 01:12 schrieb fir:
> in history of c there are some syayemants like goto is evil, global variable accesses (some of them i mean more linke non -streamlined writes toi small global variables) are evil, and more
>
> i was already writin on that somewhat but sometimes i just notice some
> somewhat new 'take' on things (like seing some previos statements a bit more generally etc) and its maybe worth mentioning
>
> pointers inded i find evil
>
> in c when you got things like that
>
> int a = 3;
> int foo() {}
> int tab[100];
>
> a,foo,tab are adresses and its fully okay.. each of this thing lays somewhere in ram takes place and has its adress - and this is good thing
>
> if you then make
>
> int& tab_p = tab;
>
> then its something like writing to local variable or abusing gotos,
> it is asking yourself for trouble
>
> and thats mostly it, what i want to say at the moment on this ..
> people should rather avoid breaking 1-1 correspondence (of adres and ram) - its maybe not such bat do have n-1 correspondence but making those adresses pointers and make them probe to change its containing values making space for 'desynchronisation'

Use a different language if you like.

Re: pointers are evil (mostly)

<a52b59a2-f274-47f8-985e-1d5c7ba39efan@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ae9:f006:0:b0:742:839d:72dd with SMTP id l6-20020ae9f006000000b00742839d72ddmr3323178qkg.8.1678122999051;
Mon, 06 Mar 2023 09:16:39 -0800 (PST)
X-Received: by 2002:a5b:b07:0:b0:a9d:be6e:3340 with SMTP id
z7-20020a5b0b07000000b00a9dbe6e3340mr6803621ybp.1.1678122998812; Mon, 06 Mar
2023 09:16:38 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 6 Mar 2023 09:16:38 -0800 (PST)
In-Reply-To: <622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:545a:2982:9d74:ecff;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:545a:2982:9d74:ecff
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <tt6rbr$1pkqc$1@dont-email.me>
<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com> <a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
<fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com> <622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a52b59a2-f274-47f8-985e-1d5c7ba39efan@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Mon, 06 Mar 2023 17:16:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1785
 by: Ed Prochak - Mon, 6 Mar 2023 17:16 UTC

fir,

I'm not ignoring you, just busy.

Ed

Re: pointers are evil (mostly)

<f89b7f3e-46fd-4ed9-a091-2a7cbd8569adn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:4d4:0:b0:71f:b89c:5ac7 with SMTP id 203-20020a3704d4000000b0071fb89c5ac7mr1718032qke.8.1678211382856;
Tue, 07 Mar 2023 09:49:42 -0800 (PST)
X-Received: by 2002:a81:ac21:0:b0:534:2d49:7912 with SMTP id
k33-20020a81ac21000000b005342d497912mr9782248ywh.6.1678211382545; Tue, 07 Mar
2023 09:49:42 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 7 Mar 2023 09:49:42 -0800 (PST)
In-Reply-To: <e53b8493-b668-45e9-a13f-9cd7622d5e54n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:545a:2982:9d74:ecff;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:545a:2982:9d74:ecff
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com> <a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com> <tt6rbr$1pkqc$1@dont-email.me>
<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com> <a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
<fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com> <622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>
<e53b8493-b668-45e9-a13f-9cd7622d5e54n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f89b7f3e-46fd-4ed9-a091-2a7cbd8569adn@googlegroups.com>
Subject: Re: pointers are evil (mostly)
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Tue, 07 Mar 2023 17:49:42 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 6855
 by: Ed Prochak - Tue, 7 Mar 2023 17:49 UTC

On Tuesday, February 28, 2023 at 8:21:45 PM UTC-5, fir wrote:
> wtorek, 28 lutego 2023 o 04:19:23 UTC+1 fir napisał(a):
> > wtorek, 28 lutego 2023 o 04:12:08 UTC+1 fir napisał(a):
> > > poniedziałek, 27 lutego 2023 o 05:34:07 UTC+1 Ed Prochak napisał(a):
[]
> > > > A better solution IMHO is conducting code reviews. More experienced senior engineers can
> > > > tell when an apparent abuse of a pointer might just be a clever optimization requiring just
> > > > a detailed explanation in the comments. Or when a seemingly simple use of a pointer might
> > > > truly be an abuse of the feature.
> > > >
> > > > Ed
> > > well i dint see pointers abused (mostly becouse i very rarely read others people code,

Well, perhaps you should read some others code. It is a good way to learn many things
like
coding styles (indentation, placement of braces, variable and function naming),
cases where pointers make much cleaner and more maintainable code (linked lists, trees)
proper use of functions from standard and optional libraries,
efficient algorithms and application of standard algorithms,
reliable code techniques (error checking and recovery)
Multitasking and multi-threading
and other programming skills.

I'm a little curious. Are you programming for your work or for yourself?
What kinds of software do you write?
User applications? Business applications? Scientific processing?
Communications? Operating systems or libraries? Embedded systems?

> > > also i guess its hard to abuse pointers)

Wait. you say pointers are evil, but hard to abuse? confusing.
I think you meant something else here.

> > >
> > > what i say is something other, its not quiote on usage of pointers by people
> > > but understanding its nature (and how it should be treated)

Exactly. It does take some time to really understand when a pointer is the best tool.
Ways to improve your understanding include
reading code produced by more senior software developers at work,
reading books on the C language and programming in general,
learning other languages and when they are better for the task at hand.

> > >
> > > what i say that adresses are ok but pointers not quite
> > >
> > > maybe some example for example allocating memory by mallooc
> > > creates pointer and this is bad becouse pointer is evil, it would be better to create not a pointer but a name containing adress
> > so what iu was saying is more like highly theoretical, but has some practocal outcome in understanding/treating the languege
> >
> > as to what i say here
> >
> > int* buf = malloc(1000);
> >
> > is evil becouse pointer is evil as i said

"i said" presents your opinion. you have yet to show any evidence of why you think it is "evil"

> > by coincidence you dont need buff to be a pointer you need it to be
> > an label (adress + name pair)
You are starting to define the syntax for another language here.
This is still just your opinion.
> >
> > you dont need to change the pointer value etc

WHAT?! How do you know what my programming needs are?

> >
> > sou you would rather need
> >
> > int buf[] = malloc(1000);
> >
> > and here buf is not a pointer, note, it shouldnt be

And here, you should note that
int buf[] = malloc(1000);
is invalid. Essentially this confirms that you are asking to a change in the C language.

> c also abuses that not only in mallock

C programmers may abuse malloc() and pointers, but the language C cannot.
(This may be a problem of language. I see you are Polski. I have Polish ancestors.)

> but in function
> arguments
>
> int print2(char* txt)
> {
> //you dont need here a pointer txt placet in its ram, to be able to change it etc,
> // you only need and adress to read freoim it or eventually write under itt
> }
You claim this is an abuse of pointers, but this is standard C syntax and style.
All C programmers should be comfortable with this.

The abuse, if any, of the pointer txt would happen in the body of the function.
You did not show that abuse.

>
> in c nomenclature as i said i would rather write it
> int print2(char txt[])
> {
> }
>
> here txt is adres not a pointer (in my provate nomenclature
> here txt is two adresses)

Again you are merely repeating a proposed change to the C language.

>
> some also my see it as c++ reference
> int print2(char& txt)
> {
> }
>
> though i dilike c++ and there is no need to name it as reference
> but notatiuon is ok in showing difference between char& (which is adress) and chat* wgich is pointer that is logical abuse

If you want, then program in C++. The C language exists for a different purpose and
includes the pointer features for very valid reasons.

And in the full context of programming, you still have
not given a reason why you think pointers are "evil".

Have a good day,
Ed

Re: pointers are evil (mostly)

<20230309120746.4e35005129f964b86a4de87f@g{oogle}mail.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: anton....@g{oogle}mail.com (Anton Shepelev)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Thu, 9 Mar 2023 12:07:46 +0300
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <20230309120746.4e35005129f964b86a4de87f@g{oogle}mail.com>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
<a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com>
<tt6rbr$1pkqc$1@dont-email.me>
<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com>
<a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
<fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com>
<622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>
<e53b8493-b668-45e9-a13f-9cd7622d5e54n@googlegroups.com>
<f89b7f3e-46fd-4ed9-a091-2a7cbd8569adn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="e72dc447bb7762d26666a8889ae87e12";
logging-data="1443992"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19H2d2Y8dOcnhDt65Y4Hi+L7ntcNNCOAGk="
Cancel-Lock: sha1:OH0FdTOV7tcFwtsTZEJnmfvgpTk=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
 by: Anton Shepelev - Thu, 9 Mar 2023 09:07 UTC

Ed Prochak:

> cases where pointers make much cleaner and more
> maintainable code (linked lists, trees)

The simplest approach to such lists or trees involves
allocating each element with a separate malloc() call. Does
it provide sufficient performance is the majority of
production code?

--
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments

Re: pointers are evil (mostly)

<tuvu72$1iiar$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: polco...@gmail.com (olcott)
Newsgroups: comp.lang.c
Subject: Re: pointers are evil (mostly)
Date: Thu, 16 Mar 2023 15:29:21 -0500
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <tuvu72$1iiar$1@dont-email.me>
References: <41bb299a-3bf2-4064-9f54-75bcc81fb12en@googlegroups.com>
<0f13b041-8675-4ce5-aa98-f9604b87f7d3n@googlegroups.com>
<a3e126a4-d38d-4071-ade5-752b20aacbe6n@googlegroups.com>
<93bdd10d-d175-4186-85d7-9c06235ea5c5n@googlegroups.com>
<tt6rbr$1pkqc$1@dont-email.me>
<410fa1b3-de17-49a6-9ab4-740fc7546a38n@googlegroups.com>
<a6334787-03bd-43cb-a600-a935831efc72n@googlegroups.com>
<fb841003-5837-4094-b5cb-e826b9156c4an@googlegroups.com>
<622f4169-0b86-4ef9-96cd-a2ede98a5b53n@googlegroups.com>
<e53b8493-b668-45e9-a13f-9cd7622d5e54n@googlegroups.com>
<f89b7f3e-46fd-4ed9-a091-2a7cbd8569adn@googlegroups.com>
<20230309120746.4e35005129f964b86a4de87f@g{oogle}mail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 16 Mar 2023 20:29:22 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="782cca759a663c7ea66234564becb995";
logging-data="1657179"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mG+I7ODzkjbzmzCq8/uXi"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.8.0
Cancel-Lock: sha1:cELG8ANJuU/Q8Aag03xBjDDfiY0=
In-Reply-To: <20230309120746.4e35005129f964b86a4de87f@g{oogle}mail.com>
Content-Language: en-US
 by: olcott - Thu, 16 Mar 2023 20:29 UTC

On 3/9/2023 3:07 AM, Anton Shepelev wrote:
> Ed Prochak:
>
>> cases where pointers make much cleaner and more
>> maintainable code (linked lists, trees)
>
> The simplest approach to such lists or trees involves
> allocating each element with a separate malloc() call. Does
> it provide sufficient performance is the majority of
> production code?
>

The memory leak errors made possible by pointers can be easily
eliminated by compiling the code as C++ and using the standard template
library for all memory allocation.

--
Copyright 2023 Olcott "Talent hits a target no one else can hit; Genius
hits a target no one else can see." Arthur Schopenhauer


devel / comp.lang.c / Re: pointers are evil (mostly)

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor