Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #89514 > unrolled thread
| Started by | Lynn McGuire <lynnmcguire5@gmail.com> |
|---|---|
| First post | 2023-03-07 15:38 -0600 |
| Last post | 2023-04-06 00:42 -0700 |
| Articles | 20 on this page of 146 — 22 participants |
Back to article view | Back to comp.lang.c++
"C++ on the Move" by Darryl K. Taft Lynn McGuire <lynnmcguire5@gmail.com> - 2023-03-07 15:38 -0600
Re: "C++ on the Move" by Darryl K. Taft legalize+jeeves@mail.xmission.com (Richard) - 2023-03-07 22:08 +0000
Re: "C++ on the Move" by Darryl K. Taft Lynn McGuire <lynnmcguire5@gmail.com> - 2023-03-07 16:25 -0600
Re: "C++ on the Move" by Darryl K. Taft legalize+jeeves@mail.xmission.com (Richard) - 2023-03-07 23:10 +0000
Re: "C++ on the Move" by Darryl K. Taft Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-08 08:40 +0200
Re: "C++ on the Move" by Darryl K. Taft Lynn McGuire <lynnmcguire5@gmail.com> - 2023-04-05 19:30 -0500
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-07 23:21 -0800
Re: "C++ on the Move" by Darryl K. Taft scott@slp53.sl.home (Scott Lurndal) - 2023-03-08 16:10 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-08 19:47 +0100
Re: "C++ on the Move" by Darryl K. Taft Michael S <already5chosen@yahoo.com> - 2023-03-08 11:21 -0800
Re: "C++ on the Move" by Darryl K. Taft scott@slp53.sl.home (Scott Lurndal) - 2023-03-08 19:49 +0000
Re: "C++ on the Move" by Darryl K. Taft Michael S <already5chosen@yahoo.com> - 2023-03-08 12:08 -0800
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-08 09:52 -0800
Re: "C++ on the Move" by Darryl K. Taft Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-03-08 10:18 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-08 20:45 +0100
Re: "C++ on the Move" by Darryl K. Taft "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-03-08 19:20 +0100
Re: "C++ on the Move" by Darryl K. Taft James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-03-08 14:10 -0500
Re: "C++ on the Move" by Darryl K. Taft "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-03-08 22:34 +0100
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-08 14:29 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-09 00:59 +0100
Re: "C++ on the Move" by Darryl K. Taft James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-03-08 18:11 -0500
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-08 12:28 -0800
Re: "C++ on the Move" by Darryl K. Taft Michael S <already5chosen@yahoo.com> - 2023-03-08 12:48 -0800
Re: "C++ on the Move" by Darryl K. Taft "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-03-08 22:40 +0100
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-09 01:12 +0100
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-08 16:27 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-09 13:52 +0100
Re: "C++ on the Move" by Darryl K. Taft Michael S <already5chosen@yahoo.com> - 2023-03-09 12:47 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-09 01:08 +0100
Re: "C++ on the Move" by Darryl K. Taft Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-03-09 02:08 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-09 14:06 +0100
Re: "C++ on the Move" by Darryl K. Taft Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-03-09 07:14 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-09 20:32 +0100
Re: "C++ on the Move" by Darryl K. Taft Michael S <already5chosen@yahoo.com> - 2023-03-09 12:42 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 00:30 +0100
Re: "C++ on the Move" by Darryl K. Taft scott@slp53.sl.home (Scott Lurndal) - 2023-03-10 15:01 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 16:38 +0100
Re: "C++ on the Move" by Darryl K. Taft scott@slp53.sl.home (Scott Lurndal) - 2023-03-10 16:36 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-11 10:43 +0100
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-08 12:59 -0800
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-09 03:03 -0800
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-09 12:12 -0800
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-09 19:20 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 10:36 +0100
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-10 04:27 -0800
Re: "C++ on the Move" by Darryl K. Taft Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-03-10 05:13 -0800
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-10 06:05 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 15:59 +0100
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-10 15:14 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 16:45 +0100
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-10 16:02 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-13 11:45 +0100
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-13 12:00 +0000
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-13 12:26 +0000
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-13 15:00 +0000
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-13 15:18 +0000
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-13 16:00 +0000
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-13 18:43 +0000
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-14 09:26 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-14 13:30 +0100
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-14 16:16 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-14 17:49 +0100
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-14 17:14 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-14 23:05 +0100
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-15 08:39 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-15 17:31 +0100
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-15 17:11 +0000
Re: "C++ on the Move" by Darryl K. Taft Ben Bacarisse <ben.lists@bsb.me.uk> - 2023-03-15 00:10 +0000
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-03-14 14:52 -0700
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-13 20:17 +0100
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-13 19:31 +0000
Re: "C++ on the Move" by Darryl K. Taft Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-14 00:01 +0200
Re: "C++ on the Move" by Darryl K. Taft gst <g.starck@gmail.com> - 2023-03-13 23:49 -0700
Re: "C++ on the Move" by Darryl K. Taft "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-03-14 11:04 +0100
Re: "C++ on the Move" by Darryl K. Taft gst <g.starck@gmail.com> - 2023-03-14 03:26 -0700
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-14 09:08 +0100
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-03-14 01:21 -0700
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-03-14 15:12 -0700
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-14 09:31 +0000
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-14 09:51 +0000
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-14 09:56 +0000
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-14 10:30 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-14 13:41 +0100
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-03-14 14:50 -0700
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-03-14 14:13 -0700
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-14 21:53 +0000
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-04-04 23:21 -0700
Re: "C++ on the Move" by Darryl K. Taft "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2023-04-05 08:44 -0700
Re: "C++ on the Move" by Darryl K. Taft legalize+jeeves@mail.xmission.com (Richard) - 2023-04-05 15:47 +0000
Re: "C++ on the Move" by Darryl K. Taft scott@slp53.sl.home (Scott Lurndal) - 2023-04-05 16:33 +0000
Re: "C++ on the Move" by Darryl K. Taft richardthiebaud <thiebauddick2@aol.com> - 2023-04-05 12:53 -0400
Re: "C++ on the Move" by Darryl K. Taft scott@slp53.sl.home (Scott Lurndal) - 2023-04-05 17:19 +0000
Re: "C++ on the Move" by Darryl K. Taft Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-04-05 13:47 -0700
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-04-06 08:12 +0000
Re: "C++ on the Move" by Darryl K. Taft Daniel <danielaparker@gmail.com> - 2023-04-06 05:23 -0700
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-04-06 08:09 +0000
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-07-20 10:02 -0700
Re: "C++ on the Move" by Darryl K. Taft Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-04-05 21:04 +0100
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-07-20 09:52 -0700
Re: "C++ on the Move" by Darryl K. Taft Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-07-20 21:01 +0100
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-03-14 08:57 -0700
Re: "C++ on the Move" by Darryl K. Taft Muttley@dastardlyhq.com - 2023-03-14 16:20 +0000
Re: "C++ on the Move" by Darryl K. Taft Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-03-10 07:23 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 16:48 +0100
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 15:54 +0100
Re: "C++ on the Move" by Darryl K. Taft Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-03-10 07:12 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 16:53 +0100
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-10 08:20 -0800
Re: "C++ on the Move" by Darryl K. Taft kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-03-10 16:48 +0000
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-12 11:54 +0100
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-12 09:29 -0700
Re: "C++ on the Move" by Darryl K. Taft Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-03-12 09:57 -0700
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-12 10:26 -0700
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-13 14:40 +0100
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-13 08:59 -0700
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-12 14:17 -0700
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-12 16:18 -0700
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-13 14:30 +0100
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-13 08:25 -0700
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-13 17:54 +0100
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-14 13:27 -0700
Re: "C++ on the Move" by Darryl K. Taft Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-13 20:37 +0200
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-14 13:30 -0700
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-13 10:02 -0700
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-13 20:21 +0100
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-13 12:53 -0700
Re: "C++ on the Move" by Darryl K. Taft Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-03-14 01:17 -0700
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-14 09:55 +0100
Re: "C++ on the Move" by Darryl K. Taft scott@slp53.sl.home (Scott Lurndal) - 2023-03-10 16:27 +0000
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-10 11:33 -0800
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-10 11:14 -0800
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-11 04:10 -0800
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-12 12:06 +0100
Re: "C++ on the Move" by Darryl K. Taft Öö Tiib <ootiib@hot.ee> - 2023-03-12 09:29 -0700
Re: "C++ on the Move" by Darryl K. Taft Bonita Montero <Bonita.Montero@gmail.com> - 2023-03-09 15:26 +0100
Re: "C++ on the Move" by Darryl K. Taft Lynn McGuire <lynnmcguire5@gmail.com> - 2023-03-09 16:59 -0600
Re: "C++ on the Move" by Darryl K. Taft Bonita Montero <Bonita.Montero@gmail.com> - 2023-03-10 05:59 +0100
Re: "C++ on the Move" by Darryl K. Taft "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-03-10 09:17 +0100
Re: "C++ on the Move" by Darryl K. Taft Bonita Montero <Bonita.Montero@gmail.com> - 2023-03-10 13:38 +0100
Re: "C++ on the Move" by Darryl K. Taft Michael S <already5chosen@yahoo.com> - 2023-03-10 05:10 -0800
Re: "C++ on the Move" by Darryl K. Taft Bonita Montero <Bonita.Montero@gmail.com> - 2023-03-10 15:20 +0100
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 16:13 +0100
Re: "C++ on the Move" by Darryl K. Taft David Brown <david.brown@hesbynett.no> - 2023-03-10 10:44 +0100
Re: "C++ on the Move" by Darryl K. Taft Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-10 11:08 -0800
Re: "C++ on the Move" by Darryl K. Taft "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-03-12 11:42 +0100
Re: "C++ on the Move" by Darryl K. Taft "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-04-06 00:42 -0700
Page 3 of 8 — ← Prev page 1 2 [3] 4 5 6 7 8 Next page →
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2023-03-09 03:03 -0800 |
| Message-ID | <2a137f2c-3104-4456-8953-2d4fef9c342en@googlegroups.com> |
| In reply to | #89535 |
On Wednesday, 8 March 2023 at 19:53:09 UTC+2, Keith Thompson wrote: > Öö Tiib <oot...@hot.ee> writes: > > On Wednesday, 8 March 2023 at 00:26:14 UTC+2, Lynn McGuire wrote: > >> On 3/7/2023 4:08 PM, Richard wrote: > >> > [Please do not mail me a copy of your followup] > >> > > >> > Lynn McGuire <lynnmc...@gmail.com> spake the secret code > >> > <tu8at1$ijm1$1...@dont-email.me> thusly: > >> > > >> >> "C++ on the Move" by Darryl K. Taft > >> > > >> > A ho-hum article IMO. You've posted better :). > >> > >> I was curious in what people thought of the last paragraph, "“Now bring > >> Rust to the table — a language well-suited for the low-level programming > >> that C++ typically dominates, but with built-in memory safety and other > >> modern features,” Campbell said. “When luminaries like Mark Russinovich > >> are saying things like [‘…halt starting any new projects in C/C++ and > >> use Rust…’], C++ must evolve or be left behind. The question is, at what > >> price?” he said." > >> https://twitter.com/markrussinovich/status/1571995117233504257?lang=en > >> > > Most people agree that C++ contains too lot of features. They only differ > > by opinion where to cut. I would put most effort into places where it says > > "undefined behavior". I think half of such places can be replaced with > > "program is ill formed", "std::terminate is called" or one of the features > > that lead to described situation can be cut out (as badly thought thru). > > I'd be interested in seeing some cases of undefined behavior that could > reasonably be detected at compile time or at run time. I'm sure there > are some, but I'd be surprised it were as many as half. > There are lot of low hanging undefined or unspecified behavior. Even what I've open at the moment. <https://en.cppreference.com/w/cpp/io/c/FILE> "While it may be possible to copy a valid std::FILE, using a pointer to such a copy as an argument for an I/O function invokes unspecified behavior." Such situation made sense maybe at 1998 ... at 2023 can require that copying std::FILE is compiling error. > Just one example: Signed integer overflow has undefined behavior, and > defining it would require runtime checks. > Ideally such run-time checks will cost something only at hardware level or when failing. So when programming languages require checks then hardware guys have market for putting those in. Unfortunately the wannabe "better C++s" tend to choose wrap around instead of failure on case of signed overflow. Wrap around is what hardware already does but it makes very rarely sense. For most programs an integer overflow is error like division by zero. I would just add something for example "_Unsafe int" and "_Wrapping int" for those who want signed int to have undefined behavior or wrap around.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2023-03-09 12:12 -0800 |
| Message-ID | <871qlxr8e7.fsf@nosuchdomain.example.com> |
| In reply to | #89568 |
Öö Tiib <ootiib@hot.ee> writes:
> On Wednesday, 8 March 2023 at 19:53:09 UTC+2, Keith Thompson wrote:
>> Öö Tiib <oot...@hot.ee> writes:
>> > On Wednesday, 8 March 2023 at 00:26:14 UTC+2, Lynn McGuire wrote:
>> >> On 3/7/2023 4:08 PM, Richard wrote:
>> >> > [Please do not mail me a copy of your followup]
>> >> >
>> >> > Lynn McGuire <lynnmc...@gmail.com> spake the secret code
>> >> > <tu8at1$ijm1$1...@dont-email.me> thusly:
>> >> >
>> >> >> "C++ on the Move" by Darryl K. Taft
>> >> >
>> >> > A ho-hum article IMO. You've posted better :).
>> >>
>> >> I was curious in what people thought of the last paragraph, "“Now bring
>> >> Rust to the table — a language well-suited for the low-level programming
>> >> that C++ typically dominates, but with built-in memory safety and other
>> >> modern features,” Campbell said. “When luminaries like Mark Russinovich
>> >> are saying things like [‘…halt starting any new projects in C/C++ and
>> >> use Rust…’], C++ must evolve or be left behind. The question is, at what
>> >> price?” he said."
>> >> https://twitter.com/markrussinovich/status/1571995117233504257?lang=en
>> >>
>> > Most people agree that C++ contains too lot of features. They only differ
>> > by opinion where to cut. I would put most effort into places where it says
>> > "undefined behavior". I think half of such places can be replaced with
>> > "program is ill formed", "std::terminate is called" or one of the features
>> > that lead to described situation can be cut out (as badly thought thru).
>>
>> I'd be interested in seeing some cases of undefined behavior that could
>> reasonably be detected at compile time or at run time. I'm sure there
>> are some, but I'd be surprised it were as many as half.
>>
> There are lot of low hanging undefined or unspecified behavior. Even what
> I've open at the moment. <https://en.cppreference.com/w/cpp/io/c/FILE>
> "While it may be possible to copy a valid std::FILE, using a pointer to such
> a copy as an argument for an I/O function invokes unspecified behavior."
> Such situation made sense maybe at 1998 ... at 2023 can require that
> copying std::FILE is compiling error.
FILE is defined in the C standard library. The C standard says:
The address of the FILE object used to control a stream may be
significant; a copy of a FILE object need not serve in place of the
original.
which means that the behavior of passing a pointer to a copied FILE
object to a library function is implicitly undefined. (I'm not sure why
cppreference says the behavior is unspecified.)
C *can't* make copying a FILE object illegal. A C++ library
implementation could implement its own FILE type as a wrapper around the
C FILE type and prohibit copying it, but then passing a C++ FILE*
pointer to a C function that expects a C FILE* pointer would be awkward
at best. Maybe you could define implicit conversions (I'm not sure
whether that's even possible), but covering all the cases would be
difficult.
And I don't think it would even be worth the effort. FILE is treated as
an opaque type. That opacity isn't enforced, but I've never seen C or
C++ code that copies or even defines a FILE object. Real code just uses
FILE* pointers. It's a very minor corner case. If I wanted to provide
definitions for as much undefined behavior as possible, copying FILE
objects would be very low on my list.
>> Just one example: Signed integer overflow has undefined behavior, and
>> defining it would require runtime checks.
>>
> Ideally such run-time checks will cost something only at hardware level
> or when failing.
Ideally, sure.
> So when programming languages require checks then hardware guys have
> market for putting those in.
>
> Unfortunately the wannabe "better C++s" tend to choose wrap around
> instead of failure on case of signed overflow. Wrap around is what
> hardware already does but it makes very rarely sense. For most
> programs an integer overflow is error like division by zero.
> I would just add something for example "_Unsafe int" and
> "_Wrapping int" for those who want signed int to have undefined
> behavior or wrap around.
First you have to define what you mean by "failure". Do you want
evaluating INT_MAX+1 to abort the program? Throw an exception? Emit
nasal demons?
We're stuck with hardware with wraparound behavior for the foreseeable
future. Conceivably if C and C++ started requiring trapping on signed
overflow, hardware would gradually be updated to make that more
efficient, but we wouldn't see the effects for decades.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2023-03-09 19:20 -0800 |
| Message-ID | <f23d2cd0-5009-49bf-a279-659837065635n@googlegroups.com> |
| In reply to | #89590 |
On Thursday, 9 March 2023 at 22:13:06 UTC+2, Keith Thompson wrote: > Öö Tiib <oot...@hot.ee> writes: > > On Wednesday, 8 March 2023 at 19:53:09 UTC+2, Keith Thompson wrote: > >> Öö Tiib <oot...@hot.ee> writes: > >> > On Wednesday, 8 March 2023 at 00:26:14 UTC+2, Lynn McGuire wrote: > >> >> On 3/7/2023 4:08 PM, Richard wrote: > >> >> > [Please do not mail me a copy of your followup] > >> >> > > >> >> > Lynn McGuire <lynnmc...@gmail.com> spake the secret code > >> >> > <tu8at1$ijm1$1...@dont-email.me> thusly: > >> >> > > >> >> >> "C++ on the Move" by Darryl K. Taft > >> >> > > >> >> > A ho-hum article IMO. You've posted better :). > >> >> > >> >> I was curious in what people thought of the last paragraph, "“Now bring > >> >> Rust to the table — a language well-suited for the low-level programming > >> >> that C++ typically dominates, but with built-in memory safety and other > >> >> modern features,” Campbell said. “When luminaries like Mark Russinovich > >> >> are saying things like [‘…halt starting any new projects in C/C++ and > >> >> use Rust…’], C++ must evolve or be left behind. The question is, at what > >> >> price?” he said." > >> >> https://twitter.com/markrussinovich/status/1571995117233504257?lang=en > >> >> > >> > Most people agree that C++ contains too lot of features. They only differ > >> > by opinion where to cut. I would put most effort into places where it says > >> > "undefined behavior". I think half of such places can be replaced with > >> > "program is ill formed", "std::terminate is called" or one of the features > >> > that lead to described situation can be cut out (as badly thought thru). > >> > >> I'd be interested in seeing some cases of undefined behavior that could > >> reasonably be detected at compile time or at run time. I'm sure there > >> are some, but I'd be surprised it were as many as half. > >> > > There are lot of low hanging undefined or unspecified behavior. Even what > > I've open at the moment. <https://en.cppreference.com/w/cpp/io/c/FILE> > > "While it may be possible to copy a valid std::FILE, using a pointer to such > > a copy as an argument for an I/O function invokes unspecified behavior." > > Such situation made sense maybe at 1998 ... at 2023 can require that > > copying std::FILE is compiling error. > FILE is defined in the C standard library. The C standard says: > > The address of the FILE object used to control a stream may be > significant; a copy of a FILE object need not serve in place of the > original. > > which means that the behavior of passing a pointer to a copied FILE > object to a library function is implicitly undefined. (I'm not sure why > cppreference says the behavior is unspecified.) > > C *can't* make copying a FILE object illegal. A C++ library > implementation could implement its own FILE type as a wrapper around the > C FILE type and prohibit copying it, but then passing a C++ FILE* > pointer to a C function that expects a C FILE* pointer would be awkward > at best. Maybe you could define implicit conversions (I'm not sure > whether that's even possible), but covering all the cases would be > difficult. > > And I don't think it would even be worth the effort. FILE is treated as > an opaque type. That opacity isn't enforced, but I've never seen C or > C++ code that copies or even defines a FILE object. Real code just uses > FILE* pointers. It's a very minor corner case. If I wanted to provide > definitions for as much undefined behavior as possible, copying FILE > objects would be very low on my list. For me personally most undefined or unspecified behaviors individually are low on list. The total time of explaining that this or that is such behavior will be reduced and so people can deal with something more valuable and therefore they have better programming language. Compiler is tool, so can be required to add diagnostic. On case of FILE I see no technical difficulties for neither C nor for C++ compiler. Would probably just add some __attribute__ to the type for to ensure that diagnostic was not confusing about copying incomplete type but about copying what should not be copied. > >> Just one example: Signed integer overflow has undefined behavior, and > >> defining it would require runtime checks. > >> > > Ideally such run-time checks will cost something only at hardware level > > or when failing. > > Ideally, sure. > > > So when programming languages require checks then hardware guys have > > market for putting those in. > > > > Unfortunately the wannabe "better C++s" tend to choose wrap around > > instead of failure on case of signed overflow. Wrap around is what > > hardware already does but it makes very rarely sense. For most > > programs an integer overflow is error like division by zero. > > I would just add something for example "_Unsafe int" and > > "_Wrapping int" for those who want signed int to have undefined > > behavior or wrap around. > First you have to define what you mean by "failure". Do you want > evaluating INT_MAX+1 to abort the program? Throw an exception? Emit > nasal demons? > I would prefer exception or signal. > We're stuck with hardware with wraparound behavior for the foreseeable > future. Conceivably if C and C++ started requiring trapping on signed > overflow, hardware would gradually be updated to make that more > efficient, but we wouldn't see the effects for decades. > It is all about the trend. Most platforms trap on division by zero for very long time. Yet the standards declare that they define nothing. That philosophy of unreliability of most performant languages has to be repaired for hardware designers to see that there is market for their efforts.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2023-03-10 10:36 +0100 |
| Message-ID | <tuetma$1tglu$1@dont-email.me> |
| In reply to | #89597 |
On 10/03/2023 04:20, Öö Tiib wrote: > It is all about the trend. Most platforms trap on division by zero for > very long time. Yet the standards declare that they define nothing. No, most platforms do not trap on division by zero. The solid majority of different types of platforms that are programmed in C (and C++ gets this stuff from C) are small microcontrollers and other embedded processors. The solid majority of processor cores made and sold are small microcontrollers. While it is true that pretty much all "big" processors and "big" OS's will trap on division by zero, the C and C++ world is very much wider than that. And it is absolutely correct for the standards to say nothing about how division by zero should be handled (i.e., it should be left undefined behaviour). There is a strong tendency amongst programmers to think that all processors are x86 or ARM, and all OS's are Linux or Windows. Fortunately, the C and C++ standards committees are not as limited. (I am of the opinion that undefined behaviour is often a good thing for code that is clearly wrong, even if there were a consensus for how it might be treated in most hardware. I want division by zero to be undefined, because it means debug tools and analysers can be used to help track such bugs in the code. But that is an orthogonal issue.)
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2023-03-10 04:27 -0800 |
| Message-ID | <c0f7eee9-0a30-47d4-a303-ac974ecd8514n@googlegroups.com> |
| In reply to | #89602 |
On Friday, 10 March 2023 at 11:36:26 UTC+2, David Brown wrote: > On 10/03/2023 04:20, Öö Tiib wrote: > > > It is all about the trend. Most platforms trap on division by zero for > > very long time. Yet the standards declare that they define nothing. > No, most platforms do not trap on division by zero. > > The solid majority of different types of platforms that are programmed > in C (and C++ gets this stuff from C) are small microcontrollers and > other embedded processors. > > The solid majority of processor cores made and sold are small > microcontrollers. > Their reasoning of hardware designers is such: "division by 0 is undefined anyway and so we counted that setting all bits of result to 1 takes few less internal gates than setting all bits to 0 does." So the whole reason of such design is lack of market to trap on division by zero there. > While it is true that pretty much all "big" processors and "big" OS's > will trap on division by zero, the C and C++ world is very much wider > than that. And it is absolutely correct for the standards to say > nothing about how division by zero should be handled (i.e., it should be > left undefined behaviour). > C and C++ do not want to be portable assemblers of whatever chips, these want to be programming languages. From that viewpoint there are no reason why something that hardware does not handle (despite its cost to performance if handled is hard to notice) should be left undefined behavior. > There is a strong tendency amongst programmers to think that all > processors are x86 or ARM, and all OS's are Linux or Windows. > Fortunately, the C and C++ standards committees are not as limited. > > (I am of the opinion that undefined behaviour is often a good thing for > code that is clearly wrong, even if there were a consensus for how it > might be treated in most hardware. I want division by zero to be > undefined, because it means debug tools and analysers can be used to > help track such bugs in the code. But that is an orthogonal issue.) > The only "positive" thing of pointless undefined behaviors is job security. All the time I have wasted into memorising those and learning usage of tools to track those down gives me advantage on job market. But the work is anyway plentiful, largely badly or not done and I could do something more interesting instead of helping to track down some undefined behavior.
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.arthur.mclean@gmail.com> |
|---|---|
| Date | 2023-03-10 05:13 -0800 |
| Message-ID | <c8c13f44-44b4-4fe7-bccf-e91072385acen@googlegroups.com> |
| In reply to | #89616 |
On Friday, 10 March 2023 at 12:27:23 UTC, Öö Tiib wrote: > On Friday, 10 March 2023 at 11:36:26 UTC+2, David Brown wrote: > > > While it is true that pretty much all "big" processors and "big" OS's > > will trap on division by zero, the C and C++ world is very much wider > > than that. And it is absolutely correct for the standards to say > > nothing about how division by zero should be handled (i.e., it should be > > left undefined behaviour). > > > C and C++ do not want to be portable assemblers of whatever chips, > these want to be programming languages. From that viewpoint there > are no reason why something that hardware does not handle (despite > its cost to performance if handled is hard to notice) should be left > undefined behavior. > If we have int x; ... x++; Then most C/C++ programmers would say that it's essential that this compiles to Load accumulator with contents of memory location x. Increment accumulator. Store accumulator at memory location x. and not Load Aummulator with memory location x. Test Accumulator for equality to INT_MAX. Jump if positive to error handling code. Increment accumulator Store accumulator at memory location x. The details will vary with specific processor, of course. Otherwise the case for using C / C++ is much weaker. People accept the difficulties of fixed width types and the like, for the increased efficiency. And in a real program it's both unlikely you can do anything useful if x overflows, and unlikely that this is possible because of other contraints on the values x can hold.
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2023-03-10 06:05 -0800 |
| Message-ID | <4b3f54eb-27b4-460e-96cf-bbce79c60d88n@googlegroups.com> |
| In reply to | #89621 |
On Friday, 10 March 2023 at 15:13:58 UTC+2, Malcolm McLean wrote: > On Friday, 10 March 2023 at 12:27:23 UTC, Öö Tiib wrote: > > On Friday, 10 March 2023 at 11:36:26 UTC+2, David Brown wrote: > > > > > While it is true that pretty much all "big" processors and "big" OS's > > > will trap on division by zero, the C and C++ world is very much wider > > > than that. And it is absolutely correct for the standards to say > > > nothing about how division by zero should be handled (i.e., it should be > > > left undefined behaviour). > > > > > C and C++ do not want to be portable assemblers of whatever chips, > > these want to be programming languages. From that viewpoint there > > are no reason why something that hardware does not handle (despite > > its cost to performance if handled is hard to notice) should be left > > undefined behavior. > > > If we have > > int x; > ... > x++; > > Then most C/C++ programmers would say that it's essential that this compiles > to > Load accumulator with contents of memory location x. > Increment accumulator. > Store accumulator at memory location x. > > and not > Load Aummulator with memory location x. > Test Accumulator for equality to INT_MAX. > Jump if positive to error handling code. > Increment accumulator > Store accumulator at memory location x. > That maybe is so with most programmers or may be is not, I have no way of knowing. They are provably mistaken. I believe that experienced programmers tend to know that compilers produce programs that do what standard requires and undefined behavior in standard means that it requires nothing. For example gcc 11.2 fror x86-64 with -O3 does so: <https://godbolt.org/z/Y6bTP3MK3> There compiler "optimizes" some "simple loop up to 9" to infinite because of undefined behavior. > The details will vary with specific processor, of course. > Otherwise the case for using C / C++ is much weaker. People accept the difficulties of > fixed width types and the like, for the increased efficiency. And in a real program it's > both unlikely you can do anything useful if x overflows, and unlikely that this is possible > because of other contraints on the values x can hold. > Yes details will vary per processor, compiler and compiler options but undefined behavior has full right not to manifest now but to do it in insulting manner when your boss tries to demonstrate the "product" to key investors.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2023-03-10 15:59 +0100 |
| Message-ID | <tufgkl$20omv$3@dont-email.me> |
| In reply to | #89621 |
On 10/03/2023 14:13, Malcolm McLean wrote: > On Friday, 10 March 2023 at 12:27:23 UTC, Öö Tiib wrote: >> On Friday, 10 March 2023 at 11:36:26 UTC+2, David Brown wrote: >> >>> While it is true that pretty much all "big" processors and "big" OS's >>> will trap on division by zero, the C and C++ world is very much wider >>> than that. And it is absolutely correct for the standards to say >>> nothing about how division by zero should be handled (i.e., it should be >>> left undefined behaviour). >>> >> C and C++ do not want to be portable assemblers of whatever chips, >> these want to be programming languages. From that viewpoint there >> are no reason why something that hardware does not handle (despite >> its cost to performance if handled is hard to notice) should be left >> undefined behavior. >> > If we have > > int x; > ... > x++; > > Then most C/C++ programmers would say that it's essential that this compiles > to > Load accumulator with contents of memory location x. > Increment accumulator. > Store accumulator at memory location x. > No, most C or C++ programmers would /not/ say that. Most have no idea what an "accumulator" is. (And most use processors that do not have an accumulator.) Then there are the programmers who understand how the languages are defined and how compilers work, and would certainly not say that it is essential for a compiler to generate code like that. > and not > Load Aummulator with memory location x. > Test Accumulator for equality to INT_MAX. > Jump if positive to error handling code. > Increment accumulator > Store accumulator at memory location x. > If you are trying to say that most C and C++ programmers expect compilers to generate efficient object code for simple source code, without extra run-time checks, then say that. > The details will vary with specific processor, of course. > Otherwise the case for using C / C++ is much weaker. People accept the difficulties of > fixed width types and the like, for the increased efficiency. And in a real program it's > both unlikely you can do anything useful if x overflows, and unlikely that this is possible > because of other contraints on the values x can hold. Agreed.
[toc] | [prev] | [next] | [standalone]
| From | kalevi@kolttonen.fi (Kalevi Kolttonen) |
|---|---|
| Date | 2023-03-10 15:14 +0000 |
| Message-ID | <tufhg1$20q27$1@dont-email.me> |
| In reply to | #89627 |
David Brown <david.brown@hesbynett.no> wrote: > No, most C or C++ programmers would /not/ say that. Most have no idea > what an "accumulator" is. I am a quite lousy C programmer who knows only the basics of C++, but I have also programmed a little bit in assembly. I certainly do know how a simple CPU works, and I'd expect this to be very common knowlegde among C programmers. It is no rocket science unless you intend to get intimately familiar with all the features of a modern, complex CPU. The "register" keyword is probably the closest that C language comes to a CPU and the compilers are free to ignore "register", but if you learn the C language, you should also learn the basics of how a CPU and memory access works. It is also good to know something about how a C compiler works, so that you understand how simple C programs are translated into assembly. When I went to my University over 20 years ago, all these things were required knowlegde very early in the education process. br, KK
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2023-03-10 16:45 +0100 |
| Message-ID | <tufjbc$20omv$6@dont-email.me> |
| In reply to | #89631 |
On 10/03/2023 16:14, Kalevi Kolttonen wrote: > David Brown <david.brown@hesbynett.no> wrote: >> No, most C or C++ programmers would /not/ say that. Most have no idea >> what an "accumulator" is. > > I am a quite lousy C programmer who knows only the basics of C++, but > I have also programmed a little bit in assembly. I certainly do know how > a simple CPU works, and I'd expect this to be very common knowlegde > among C programmers. It is no rocket science unless you intend to > get intimately familiar with all the features of a modern, complex CPU. > Most programmers know nothing about assembly. And even many of those that do, would not be particularly familiar with an "accumulator" - or would use the term incorrectly. Most modern processors are not accumulator based. (x86 has a heritage that stretches back to an accumulator-based model, but has long ceased to follow that style.) (I think it is good for C and C++ programmers to have some familiarity with assembly on their main target processors.) > The "register" keyword is probably the closest that C language comes > to a CPU and the compilers are free to ignore "register", but if you > learn the C language, you should also learn the basics of how a > CPU and memory access works. Yes (although compilers can't quite ignore "register" - they are obliged to complain if you try to take the address of a "register" variable or parameter). > > It is also good to know something about how a C compiler works, so > that you understand how simple C programs are translated into > assembly. When I went to my University over 20 years ago, all these > things were required knowlegde very early in the education process. > I agree. But I don't think many programmers /are/ familiar with the workings of processors. I have no statistics, but I don't think more than a fraction of C and C++ programmers learned programming from comprehensive university-level education - short courses and self-learning are, I think, more common.
[toc] | [prev] | [next] | [standalone]
| From | kalevi@kolttonen.fi (Kalevi Kolttonen) |
|---|---|
| Date | 2023-03-10 16:02 +0000 |
| Message-ID | <tufkau$21a22$1@dont-email.me> |
| In reply to | #89634 |
David Brown <david.brown@hesbynett.no> wrote: > [...] But I don't think many programmers /are/ familiar with the > workings of processors. I have no statistics, but I don't think more > than a fraction of C and C++ programmers learned programming from > comprehensive university-level education - short courses and > self-learning are, I think, more common. Long time ago I heard of a Java programmer who found C to be totally incomprehensible. Java was the only language he knew, and as Java is full of mandatory classes/objects everywhere, his understanding of computer's inner workings was based very heavily on the notion of classes/objects. For instance, he could not see how C code could even exist "outside" any classes. I am convinced he had no understanding of how Von Neumann machine based CPUs work either. He could have been a brilliant Java programmer, though. br, KK
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2023-03-13 11:45 +0100 |
| Message-ID | <tumus2$3na9m$1@dont-email.me> |
| In reply to | #89638 |
On 10/03/2023 17:02, Kalevi Kolttonen wrote: > David Brown <david.brown@hesbynett.no> wrote: >> [...] But I don't think many programmers /are/ familiar with the >> workings of processors. I have no statistics, but I don't think more >> than a fraction of C and C++ programmers learned programming from >> comprehensive university-level education - short courses and >> self-learning are, I think, more common. > > Long time ago I heard of a Java programmer who found C to be > totally incomprehensible. Java was the only language he knew, and > as Java is full of mandatory classes/objects everywhere, his > understanding of computer's inner workings was based very heavily > on the notion of classes/objects. > > For instance, he could not see how C code could even exist > "outside" any classes. I am convinced he had no understanding of > how Von Neumann machine based CPUs work either. > > He could have been a brilliant Java programmer, though. > I think it's good to program in a variety of languages, or at least to be familiar with them. You can get inspiration for different ways to structure your code, even if the techniques are not idiomatic for the language you happen to be using. Every language has its good points and bad points, and you can learn from both.
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-03-13 12:00 +0000 |
| Message-ID | <tun39m$3ogn8$1@dont-email.me> |
| In reply to | #89704 |
On Mon, 13 Mar 2023 11:45:22 +0100 David Brown <david.brown@hesbynett.no> wrote: >On 10/03/2023 17:02, Kalevi Kolttonen wrote: >> David Brown <david.brown@hesbynett.no> wrote: >> For instance, he could not see how C code could even exist >> "outside" any classes. I am convinced he had no understanding of >> how Von Neumann machine based CPUs work either. >> >> He could have been a brilliant Java programmer, though. >> > >I think it's good to program in a variety of languages, or at least to >be familiar with them. You can get inspiration for different ways to >structure your code, even if the techniques are not idiomatic for the >language you happen to be using. Every language has its good points and >bad points, and you can learn from both. True. But some languages are just incomprehensible to some people. Personally I understood the concepts of OO within probably 10 mins of encountering it, functional programming didn't take much longer to grok and SQL similar. I must have programmed in at least 10 languages in my life but the one I could never get my head around was Prolog and I still can't. Every time I thought I understood what it was doing I'd write another bit of code and it would do something completely different to what I was expecting. I just Don't Get It. I guess my brain simply doesn't work that way.
[toc] | [prev] | [next] | [standalone]
| From | kalevi@kolttonen.fi (Kalevi Kolttonen) |
|---|---|
| Date | 2023-03-13 12:26 +0000 |
| Message-ID | <tun4pv$3op4g$1@dont-email.me> |
| In reply to | #89706 |
Muttley@dastardlyhq.com wrote: > [...] some languages are just incomprehensible to some people. One quite mind-expanding and weird language to study is Erlang. There is this saying "You can write C in any language", but with Erlang it is not true. It is so different. Despite its strangeness, Erlang is not just some kind of esoteric language that nobody actually uses for serious programming tasks. They use Erlang in some mobile phone networks, and with the ability to update your code while the programs are running, it is possible keep your code updated (e.g. security, new features) to reach 10 years of uptime. And no, I do not claim to be proficient in Erlang. I have created only small toy programs long time ago, but I have read two good books about Erlang just for educational purposes. br, KK
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-03-13 15:00 +0000 |
| Message-ID | <tundpr$3qclf$1@dont-email.me> |
| In reply to | #89707 |
On Mon, 13 Mar 2023 12:26:40 -0000 (UTC) kalevi@kolttonen.fi (Kalevi Kolttonen) wrote: >Muttley@dastardlyhq.com wrote: >> [...] some languages are just incomprehensible to some people. > >One quite mind-expanding and weird language to study is Erlang. > >There is this saying "You can write C in any language", but with >Erlang it is not true. It is so different. Its functional isn't it? Functional languages are interesting as they do polymorphism by value rather than by type IME. >They use Erlang in some mobile phone networks, and with IIRC thats why ericsson wrote it.
[toc] | [prev] | [next] | [standalone]
| From | kalevi@kolttonen.fi (Kalevi Kolttonen) |
|---|---|
| Date | 2023-03-13 15:18 +0000 |
| Message-ID | <tunere$3qj47$1@dont-email.me> |
| In reply to | #89710 |
Muttley@dastardlyhq.com wrote:
> Its functional isn't it? Functional languages are interesting as they do
> polymorphism by value rather than by type IME.
Yes, it is functional.
There are no for or while loops in Erlang, but you
have to use recursion instead.
Variables are immutable, so you assign a value to them once
and they retain it. To me, this feature is probably the
trickiest or "craziest". In so many other programming languages,
we take it for granted that the values of variables can change
during the program execution.
The following is taken straight from Wikipedia. The information
is based on Joe Armstrong's (one of language creators) PhD
Thesis:
Everything is a process.
Processes are strongly isolated.
Process creation and destruction is a lightweight operation.
Message passing is the only way for processes to interact.
Processes have unique names.
If you know the name of a process you can send it a message.
Processes share no resources.
Error handling is non-local.
Processes do what they are supposed to do or fail.
>>They use Erlang in some mobile phone networks, and with
>
> IIRC thats why ericsson wrote it.
Correct.
I just quickly glanced through the Wikipedia article
and it says there is one notable new application written
in Erlang: WhatsApp. Maybe the client code is not Erlang,
but the server infrastructure is.
br,
KK
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-03-13 16:00 +0000 |
| Message-ID | <tunhai$3r1m1$1@dont-email.me> |
| In reply to | #89711 |
On Mon, 13 Mar 2023 15:18:06 -0000 (UTC) kalevi@kolttonen.fi (Kalevi Kolttonen) wrote: >Muttley@dastardlyhq.com wrote: >> Its functional isn't it? Functional languages are interesting as they do >> polymorphism by value rather than by type IME. > >Yes, it is functional. > >There are no for or while loops in Erlang, but you >have to use recursion instead. > >Variables are immutable, so you assign a value to them once >and they retain it. To me, this feature is probably the >trickiest or "craziest". In so many other programming languages, >we take it for granted that the values of variables can change >during the program execution. Sounds like its one of those languages thats theoretically "pure" at the expense of making it hard to learn and write basic algorithms. Make a language too obtuse and few people will both to learn it as IBM found out with APL.
[toc] | [prev] | [next] | [standalone]
| From | kalevi@kolttonen.fi (Kalevi Kolttonen) |
|---|---|
| Date | 2023-03-13 18:43 +0000 |
| Message-ID | <tunqrv$3sq9s$1@dont-email.me> |
| In reply to | #89715 |
Muttley@dastardlyhq.com wrote: > Sounds like its one of those languages thats theoretically "pure" at the > expense of making it hard to learn and write basic algorithms. Make a language > too obtuse and few people will both to learn it as IBM found out with APL. I guess that many of Erlang's features are supposed to make it easier to reason about the code's correctness. For example, concerning recursion, I have heard arguments that claim it helps to avoid off-by-one mistakes that can happen pretty easily in languages such as C. Erlang processes are isolated from each other, and can communicate only using message passing. I remember reading about some kind of Actor Model and maybe it's also supposed make code correctness easier to achieve. But I do not remember the theoretical foundations of this model, it's been 13 years since I read the Erlang books. You are right in that using Erlang, you simply cannot pick a CS book about algorithms, look up what you want, and then implement it in Erlang. Erlang is of course Turing complete, so it *is* doable but not straightforward. br, KK
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-03-14 09:26 +0000 |
| Message-ID | <tupekj$97ld$1@dont-email.me> |
| In reply to | #89720 |
On Mon, 13 Mar 2023 18:43:11 -0000 (UTC) kalevi@kolttonen.fi (Kalevi Kolttonen) wrote: >Muttley@dastardlyhq.com wrote: >> Sounds like its one of those languages thats theoretically "pure" at the >> expense of making it hard to learn and write basic algorithms. Make a >language >> too obtuse and few people will both to learn it as IBM found out with APL. > >I guess that many of Erlang's features are supposed to make it easier >to reason about the code's correctness. For example, concerning recursion, >I have heard arguments that claim it helps to avoid off-by-one mistakes >that can happen pretty easily in languages such as C. Quite possibly, but recursion has its own issues. The main one being that the dev forgets to code in the correct stop checks and one day it recurses forever. Sure that can happen with a standard for loop, but its more likely to be spotted. >Erlang processes are isolated from each other, and can communicate only >using message passing. I remember reading about some kind of Actor Model >and maybe it's also supposed make code correctness easier to achieve. But Message passing is theoretically pure but horribly inefficient. >You are right in that using Erlang, you simply cannot pick a CS >book about algorithms, look up what you want, and then implement it >in Erlang. Erlang is of course Turing complete, so it *is* doable >but not straightforward. Its difficult to know when one has been steeped in traditional development style since god was a boy, but I think traditional programming is much closer to how people think. Eg "Add 1 to this, go around again. Put this value in a box and put the box in that other box" etc. Functional (and declarative) programming requires you to learn to think in a different way.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2023-03-14 13:30 +0100 |
| Message-ID | <tuppcn$b454$1@dont-email.me> |
| In reply to | #89738 |
On 14/03/2023 10:26, Muttley@dastardlyhq.com wrote: > On Mon, 13 Mar 2023 18:43:11 -0000 (UTC) > kalevi@kolttonen.fi (Kalevi Kolttonen) wrote: >> Muttley@dastardlyhq.com wrote: >>> Sounds like its one of those languages thats theoretically "pure" at the >>> expense of making it hard to learn and write basic algorithms. Make a >> language >>> too obtuse and few people will both to learn it as IBM found out with APL. >> >> I guess that many of Erlang's features are supposed to make it easier >> to reason about the code's correctness. For example, concerning recursion, >> I have heard arguments that claim it helps to avoid off-by-one mistakes >> that can happen pretty easily in languages such as C. > > Quite possibly, but recursion has its own issues. The main one being that > the dev forgets to code in the correct stop checks and one day it recurses > forever. Sure that can happen with a standard for loop, but its more likely to > be spotted. > It is rarely difficult to be sure your recursion ends - you just have to make sure you have a loop variant that gets smaller with each round, and ends at 0. Very often you are looping over a data structure (such as a list), and this happens naturally. Of course, you might /want/ infinite recursion. Many (not all) functional programming languages support lazy evaluation, and so infinite lists are commonly used. >> Erlang processes are isolated from each other, and can communicate only >> using message passing. I remember reading about some kind of Actor Model >> and maybe it's also supposed make code correctness easier to achieve. But > > Message passing is theoretically pure but horribly inefficient. That depends heavily on the implementation, and the efficiency you are considering. Message passing can give you lock-free algorithms, or close to lock-free, and can significantly simplify a lot of the rest of the code in comparison to shared memory systems. It can scale better, and work smoothly across different levels of parallelism (light-weight fibres, threads, processes, multiple cores, multiple computers). But it can be costly if you need to share large blocks of data back and forth between multiple actors. > >> You are right in that using Erlang, you simply cannot pick a CS >> book about algorithms, look up what you want, and then implement it >> in Erlang. Erlang is of course Turing complete, so it *is* doable >> but not straightforward. > > Its difficult to know when one has been steeped in traditional development > style since god was a boy, but I think traditional programming is much closer > to how people think. Eg "Add 1 to this, go around again. Put this value in a > box and put the box in that other box" etc. It is far more natural to think "Do this for each box", or "Do this for the first box. Then do the same for all the other boxes" than to think "First count the number of boxes. Then make a new counter, starting at 1. Repeatedly look at the counter, find the box that matches that number, and do this it. Then add one to the counter, and check if now matches the count of the boxes - if so, stop." > Functional (and declarative) > programming requires you to learn to think in a different way. Yes. Functional programming is often quite natural for people with a stronger background in mathematics. It has more of a focus on describing the results you want, rather than the details of how you get there (for /efficient/ implementations in functional programming, you often want to describe intermediary results along the way rather than hoping the compiler is a genius!). I think that the more experienced you are with one style, the more it will feel "natural" for you and the harder it is to get used to an alternative. That applies to all sorts of things, not just programming. But there's little doubt that some kinds of algorithms or programming problems are easier and clearer in one style of programming language, while others are easier in a different style.
[toc] | [prev] | [next] | [standalone]
Page 3 of 8 — ← Prev page 1 2 [3] 4 5 6 7 8 Next page →
Back to top | Article view | comp.lang.c++
csiph-web