Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #148634 > unrolled thread
| Started by | T <T@invalid.invalid> |
|---|---|
| First post | 2019-12-31 20:08 -0800 |
| Last post | 2020-01-21 16:44 +0100 |
| Articles | 20 on this page of 193 — 20 participants |
Back to article view | Back to comp.lang.c
Do "C" arrays start a 0 or 1? T <T@invalid.invalid> - 2019-12-31 20:08 -0800
Re: Do "C" arrays start a 0 or 1? Paul <nospam@needed.invalid> - 2019-12-31 23:50 -0500
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-01 03:28 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-01 03:49 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-01 13:26 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-01 04:34 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-01 13:56 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-01 05:04 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-01 14:18 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-01 13:21 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-01 14:26 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-01 13:19 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-01 14:24 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-01 14:56 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-01 16:06 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-01 15:44 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-01 16:54 +0100
Re: Do "C" arrays start a 0 or 1? chad <cdalten@gmail.com> - 2020-01-01 08:07 -0800
Re: Do "C" arrays start a 0 or 1? Dan Purgert <dan@djph.net> - 2020-01-01 14:19 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-01 15:28 +0100
Re: Do "C" arrays start a 0 or 1? Dan Purgert <dan@djph.net> - 2020-01-02 11:06 +0000
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-02 10:19 +0100
Re: Do "C" arrays start a 0 or 1? gazelle@shell.xmission.com (Kenny McCormack) - 2020-01-02 13:33 +0000
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-02 13:55 +0000
Raku (Was: Do "C" arrays start a 0 or 1?) gazelle@shell.xmission.com (Kenny McCormack) - 2020-01-02 14:48 +0000
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-02 15:03 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-02 06:18 -0800
Re: Do "C" arrays start a 0 or 1? m.nasim85@gmail.com - 2020-01-02 01:26 -0800
Re: Do "C" arrays start a 0 or 1? F Russell <fr@random.info> - 2020-01-05 19:32 +0000
Re: Do "C" arrays start a 0 or 1? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-05 12:25 -0800
Re: Do "C" arrays start a 0 or 1? F Russell <fr@random.info> - 2020-01-07 00:33 +0000
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 01:11 +0000
Re: Do "C" arrays start a 0 or 1? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-06 22:32 -0800
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 10:08 +0000
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 06:24 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 06:30 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 06:42 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 12:47 -0800
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 21:20 +0000
Re: Do "C" arrays start a 0 or 1? gazelle@shell.xmission.com (Kenny McCormack) - 2020-01-07 21:53 +0000
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 14:01 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 14:22 -0800
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 22:31 +0000
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-08 00:27 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-08 08:13 -0800
Re: Do "C" arrays start a 0 or 1? chad <cdalten@gmail.com> - 2020-01-07 06:33 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 06:38 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 06:49 -0800
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 16:38 +0000
Re: Do "C" arrays start a 0 or 1? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-07 10:31 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 10:44 -0800
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-07 19:54 +0100
Re: Do "C" arrays start a 0 or 1? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-01-11 10:24 -0800
Re: Do "C" arrays start a 0 or 1? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-11 14:23 -0800
Re: Do "C" arrays start a 0 or 1? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-01-21 04:21 -0800
Re: Do "C" arrays start a 0 or 1? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-21 05:06 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 10:59 -0800
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 19:21 +0000
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-07 11:36 -0800
Re: Do "C" arrays start a 0 or 1? Barry Schwarz <schwarzb@delq.com> - 2020-01-06 18:02 -0800
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-07 10:55 +0100
Re: Do "C" arrays start a 0 or 1? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-06 23:34 -0500
Re: Do "C" arrays start a 0 or 1? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-06 22:30 -0800
Re: Do "C" arrays start a 0 or 1? Richard Damon <Richard@Damon-Family.org> - 2020-01-05 16:30 -0500
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-06 02:07 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-06 07:57 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-07 08:03 +0100
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-07 08:11 +0100
Re: Do "C" arrays start a 0 or 1? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-01-07 10:09 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-07 11:12 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 11:09 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-07 13:45 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 13:06 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-07 14:14 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-07 16:27 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-07 17:53 +0100
Re: Do "C" arrays start a 0 or 1? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-01-07 08:55 -0800
Re: Do "C" arrays start a 0 or 1? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-01-07 05:19 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-11 19:11 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-11 19:09 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-11 20:18 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-11 20:00 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 07:02 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 00:32 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 09:38 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 01:09 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 10:48 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 01:57 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 11:02 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 02:09 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 12:45 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 03:54 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 13:13 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 04:35 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 13:38 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 04:44 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 13:49 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 04:59 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 14:03 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 05:21 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 14:35 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 05:46 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 15:11 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 06:41 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 16:15 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 08:11 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 08:19 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 17:42 +0100
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 17:40 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 09:04 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 18:05 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 09:13 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 18:16 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 09:25 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 18:26 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 09:21 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 18:25 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 09:31 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 18:33 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-12 13:21 +0000
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-13 09:16 +0100
Re: Do "C" arrays start a 0 or 1? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-01-13 04:28 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 13:36 +0100
Re: Do "C" arrays start a 0 or 1? Öö Tiib <ootiib@hot.ee> - 2020-01-13 04:39 -0800
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-13 15:22 +0100
Re: Do "C" arrays start a 0 or 1? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-13 05:10 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 15:10 +0100
Re: Do "C" arrays start a 0 or 1? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-13 07:31 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 16:34 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 06:59 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 16:32 +0100
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 17:17 +0100
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 18:13 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 09:19 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 18:22 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 09:29 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 18:34 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 09:40 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 18:42 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 09:56 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 19:19 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 10:21 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 19:25 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 10:46 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 08:02 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-15 01:04 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-15 01:25 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-15 06:37 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-15 10:49 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-02-04 01:15 -0800
Re: Do "C" arrays start a 0 or 1? Siri Cruise <chine.bleu@yahoo.com> - 2020-02-04 01:48 -0800
Re: Do "C" arrays start a 0 or 1? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-02-04 02:29 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-02-04 03:05 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-02-04 04:07 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-02-04 04:59 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 08:51 -0800
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-13 15:19 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 06:47 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 06:51 -0800
Re: Do "C" arrays start a 0 or 1? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-01-13 09:35 -0800
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-13 21:48 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 12:54 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-13 13:38 -0800
Re: Do "C" arrays start a 0 or 1? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-01-14 02:30 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-14 02:40 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-14 02:47 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-14 03:52 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-14 04:00 -0800
Re: Do "C" arrays start a 0 or 1? David Brown <david.brown@hesbynett.no> - 2020-01-14 14:20 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 02:21 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 12:50 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 04:14 -0800
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-12 14:23 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 16:16 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 08:13 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 17:43 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-12 17:42 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 18:43 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-12 18:04 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 19:31 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-12 21:18 +0000
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 13:53 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 19:36 +0100
Re: Do "C" arrays start a 0 or 1? Bart <bc@freeuk.com> - 2020-01-12 20:56 +0000
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 10:04 -0800
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 02:05 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 12:43 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 03:46 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 12:51 +0100
Re: Do "C" arrays start a 0 or 1? fir <profesor.fir@gmail.com> - 2020-01-12 03:58 -0800
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-12 13:14 +0100
Re: Do "C" arrays start a 0 or 1? gazelle@shell.xmission.com (Kenny McCormack) - 2020-01-07 13:03 +0000
Re: Do "C" arrays start a 0 or 1? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-21 16:44 +0100
Page 4 of 10 — ← Prev page 1 2 3 [4] 5 6 … 10 Next page →
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2020-01-07 10:55 +0100 |
| Message-ID | <qv1khu$g0v$1@dont-email.me> |
| In reply to | #148815 |
On 07/01/2020 03:02, Barry Schwarz wrote:
> On 7 Jan 2020 00:33:41 GMT, F Russell <fr@random.info> wrote:
>
>> On Sun, 05 Jan 2020 12:25:33 -0800, Keith Thompson wrote:
>>
>>>
>>> No, arrays are not pointers. An array variable holds an array object.
>>> The name of an array variable, in most but not all contexts, is treated
>>> as an array expression.
>>>
>>
>> That may be so, but for practical purposes they sure do act
>> exactly like pointers.
>
> Many of us consider the use of the sizeof, assignment, and & operators
> to be extremely practical and "they" certainly don't act like pointers
> in those cases.
>
Yes, indeed.
I think an even more fundamental difference is that when you write:
int a[10];
you get an array of 10 ints, with appropriate storage space - /not/ a
pointer to an int.
And if you want an array type which can be passed around by value
(rather than reference), and which keeps its full type and size
information in all cases (rather than decaying to a pointer when used in
an expression), you can wrap it in a struct:
typedef struct { int vs[10]; } array_of_ten_ints_t;
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Date | 2020-01-06 23:34 -0500 |
| Message-ID | <qv11o5$kq2$1@dont-email.me> |
| In reply to | #148813 |
On 1/6/20 7:33 PM, F Russell wrote:
> On Sun, 05 Jan 2020 12:25:33 -0800, Keith Thompson wrote:
>
>>
>> No, arrays are not pointers. An array variable holds an array object.
>> The name of an array variable, in most but not all contexts, is treated
>> as an array expression.
>>
>
> That may be so, but for practical purposes they sure do act
> exactly like pointers.
Exactly?
#include <stdio.h>
#define TYPEOF(expression) _Generic(expression, \
char **: "char **", char (*)[6]: "char (*)[6]")
int main(void)
{
char *pointer = "pointer";
char array[] = "array";
printf("%zu ? %zu\n", sizeof pointer, sizeof array);
printf("%s ? %s\n", TYPEOF(&pointer), TYPEOF(&array));
}
I get the following results:
8 ? 6
char ** ? char (*)[6]
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2020-01-06 22:30 -0800 |
| Message-ID | <878smjn5gv.fsf@nosuchdomain.example.com> |
| In reply to | #148813 |
F Russell <fr@random.info> writes:
> On Sun, 05 Jan 2020 12:25:33 -0800, Keith Thompson wrote:
>> No, arrays are not pointers. An array variable holds an array object.
>> The name of an array variable, in most but not all contexts, is treated
>> as an array expression.
>
> That may be so, but for practical purposes they sure do act
> exactly like pointers.
They do not. For example, sizeof(array_object) does not yield the size
of a pointer (as I mentioned in my previous post and you snipped.
Read section 6 of the comp.lang.c FAQ <http://www.c-faq.com/>.
> For example, according to the AMD64 calling convention, if
> an array name is passed as a function argument, the array
> name is actually stored in the RDI, RSI, etc. register as
> a 64-bit integer.
The fact that using an array name as a function argument causes the
address of the 0th element of the array to be passed is defined by C,
not by any calling convention. In fact C does not have parameters of
array type. There's no need to dive into assembly language to
understand that.
I urge to you read section 6 of the FAQ before replying.
[...]
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
[Note updated email address]
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | Richard Damon <Richard@Damon-Family.org> |
|---|---|
| Date | 2020-01-05 16:30 -0500 |
| Message-ID | <QzsQF.68724$oe2.33324@fx41.iad> |
| In reply to | #148792 |
On 1/5/20 2:32 PM, F Russell wrote: > On Tue, 31 Dec 2019 20:08:40 -0800, T wrote: > >> >> Not to ask to stupid a question (when does that stop >> me?), but does the default index for C arrays start >> at zero or one? >> > > In C, an array variable is simply a pointer to > a memory location, and that location holds the > first element of the array. > > It is thus natural to expect that the first > element is *(array+0) which is the same as > array[0]. > > To access the array elements, we can use this > pointer to "hop" along the sequential list. > For example, to access the 10th element we > can use *(array+9). This increments the > pointer by 9*stride_length + array so that > we find the 10th element. > > Indeed, in C, the construction array[0] > is the same as *(array+0), and array[9] > is the same as *(array+9). > As was said, Array are not just pointers, but arrays values do 'decay' into a pointer to their first element in many different situations (there is only a short list of case where it does not). This decay causes some people to over simplify the situation and say that the array actually IS that pointer. There is also the fact that array accessing uses that decayed pointer, and thus a pointer value can act for many purposes as a array (and it is also possible to make a pointer value that does actually point to an array, but that is uncommon ignoring the special case that the address of a scaler object can be treated as the address of a single element array)
[toc] | [prev] | [next] | [standalone]
| From | fir <profesor.fir@gmail.com> |
|---|---|
| Date | 2020-01-06 02:07 -0800 |
| Message-ID | <ba1cec53-74de-41a5-af73-ec16645d8859@googlegroups.com> |
| In reply to | #148794 |
W dniu niedziela, 5 stycznia 2020 22:30:33 UTC+1 użytkownik Richard Damon napisał: > On 1/5/20 2:32 PM, F Russell wrote: > > On Tue, 31 Dec 2019 20:08:40 -0800, T wrote: > > > >> > >> Not to ask to stupid a question (when does that stop > >> me?), but does the default index for C arrays start > >> at zero or one? > >> > > > > In C, an array variable is simply a pointer to > > a memory location, and that location holds the > > first element of the array. > > > > It is thus natural to expect that the first > > element is *(array+0) which is the same as > > array[0]. > > > > To access the array elements, we can use this > > pointer to "hop" along the sequential list. > > For example, to access the 10th element we > > can use *(array+9). This increments the > > pointer by 9*stride_length + array so that > > we find the 10th element. > > > > Indeed, in C, the construction array[0] > > is the same as *(array+0), and array[9] > > is the same as *(array+9). > > > > As was said, Array are not just pointers, but arrays values do 'decay' > into a pointer to their first element in many different situations > (there is only a short list of case where it does not). > > This decay causes some people to over simplify the situation and say > that the array actually IS that pointer. There is also the fact that those people lie as array is not a pointer, more to say array may take a memory from say 0x00403000 to 0x0040302f inclusively when pointer to it 0s placed at 0x00404444 to 0x00404447 or somewhere else - those are two disticnct separate ram regions the thing that array elements are indexed from zero is btw logical, though the thing that its end is associated with the first element or byte after the array is (as i once discovered/noted) wrong. array sizes should be gien in a way of "0 to 9" or size 10 but the syntax int tab[10] is kinda wrong/misleading > array accessing uses that decayed pointer, and thus a pointer value can > act for many purposes as a array (and it is also possible to make a > pointer value that does actually point to an array, but that is uncommon > ignoring the special case that the address of a scaler object can be > treated as the address of a single element array)
[toc] | [prev] | [next] | [standalone]
| From | fir <profesor.fir@gmail.com> |
|---|---|
| Date | 2020-01-06 07:57 -0800 |
| Message-ID | <4c16f038-2924-4d47-a446-2b34826c72a0@googlegroups.com> |
| In reply to | #148796 |
W dniu poniedziałek, 6 stycznia 2020 11:07:29 UTC+1 użytkownik fir napisał: > W dniu niedziela, 5 stycznia 2020 22:30:33 UTC+1 użytkownik Richard Damon napisał: > > On 1/5/20 2:32 PM, F Russell wrote: > > > On Tue, 31 Dec 2019 20:08:40 -0800, T wrote: > > > > > >> > > >> Not to ask to stupid a question (when does that stop > > >> me?), but does the default index for C arrays start > > >> at zero or one? > > >> > > > > > > In C, an array variable is simply a pointer to > > > a memory location, and that location holds the > > > first element of the array. > > > > > > It is thus natural to expect that the first > > > element is *(array+0) which is the same as > > > array[0]. > > > > > > To access the array elements, we can use this > > > pointer to "hop" along the sequential list. > > > For example, to access the 10th element we > > > can use *(array+9). This increments the > > > pointer by 9*stride_length + array so that > > > we find the 10th element. > > > > > > Indeed, in C, the construction array[0] > > > is the same as *(array+0), and array[9] > > > is the same as *(array+9). > > > > > > > As was said, Array are not just pointers, but arrays values do 'decay' > > into a pointer to their first element in many different situations > > (there is only a short list of case where it does not). > > > > This decay causes some people to over simplify the situation and say > > that the array actually IS that pointer. There is also the fact that > > those people lie as array is not a pointer, more to say array may take a memory from say 0x00403000 to 0x0040302f > inclusively when pointer to it 0s placed > at 0x00404444 to 0x00404447 or somewhere else - those are two disticnct separate ram regions > > the thing that array elements are indexed from zero is btw logical, though the thing that its end is associated with the first element or byte after the array is (as i once discovered/noted) wrong. array sizes should be gien in a way of "0 to 9" or size 10 but the syntax int tab[10] is kinda wrong/misleading > > this was once discussed here in some thread of drawing rectangles, i mean if someone want to draw rectangle of size 100 x 100 plaeced this way that left upper corener is in the pixel 70 70 he coud eentually writa a funcrtopn to give DrawRectangle(70,70,100,100) or DrawRectangle(70,70,169,169) but NOT DrawRectangle(70,70,170,170)
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2020-01-07 08:03 +0100 |
| Message-ID | <qv1af7$shr$1@news.albasani.net> |
| In reply to | #148634 |
Use C++!
With that you can have both:
#include <vector>
#include <stdexcept>
template<typename T, typename Alloc = std::allocator<T>>
struct pascal_vector : public std::vector<T, Alloc>
{
using std::vector<T, Alloc>::vector;
reference at( size_type i );
const_reference at( size_type i ) const;
reference operator []( size_type i );
const_reference operator []( size_type i ) const;
};
template<typename T, typename Alloc>
inline
typename pascal_vector<T, Alloc>::reference pascal_vector<T, Alloc>::at(
size_type i )
{
if( i < 1 )
throw std::out_of_range( "zero index!" );
return at( i - 1 );
}
template<typename T, typename Alloc>
inline
typename pascal_vector<T, Alloc>::const_reference pascal_vector<T,
Alloc>::at( size_type i ) const
{
if( i < 1 )
throw std::out_of_range( "zero index!" );
return at( i - 1 );
}
template<typename T, typename Alloc>
inline
typename pascal_vector<T, Alloc>::reference pascal_vector<T,
Alloc>::operator []( size_type i )
{
return vector::operator []( i - 1 );
}
template<typename T, typename Alloc>
inline
typename pascal_vector<T, Alloc>::const_reference pascal_vector<T,
Alloc>::operator []( size_type i ) const
{
return vector::operator []( i - 1 );
}
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2020-01-07 08:11 +0100 |
| Message-ID | <qv1avf$qsg$1@news.albasani.net> |
| In reply to | #148824 |
> template<typename T, typename Alloc>
> inline
> typename pascal_vector<T, Alloc>::reference pascal_vector<T, Alloc>::at(
> size_type i )
> {
> if( i < 1 )
> throw std::out_of_range( "zero index!" );
> return at( i - 1 );
> }
>
> template<typename T, typename Alloc>
> inline
> typename pascal_vector<T, Alloc>::const_reference pascal_vector<T,
> Alloc>::at( size_type i ) const
> {
> if( i < 1 )
> throw std::out_of_range( "zero index!" );
> return at( i - 1 );
> }
Sorry, makes an infinite tail-recursion:
template<typename T, typename Alloc>
inline
typename pascal_vector<T, Alloc>::reference pascal_vector<T, Alloc>::at(
size_type i )
{
if( i < 1 )
throw std::out_of_range( "zero index!" );
return vector<T, Alloc>::at( i - 1 );
}
template<typename T, typename Alloc>
inline
typename pascal_vector<T, Alloc>::const_reference pascal_vector<T,
Alloc>::at( size_type i ) const
{
if( i < 1 )
throw std::out_of_range( "zero index!" );
return vector<T, Alloc>::at( i - 1 );
}
[toc] | [prev] | [next] | [standalone]
| From | Jorgen Grahn <grahn+nntp@snipabacken.se> |
|---|---|
| Date | 2020-01-07 10:09 +0000 |
| Message-ID | <slrnr18m6q.9in.grahn+nntp@frailea.sa.invalid> |
| In reply to | #148824 |
On Tue, 2020-01-07, Bonita Montero wrote: > Use C++! > With that you can have both: Please stop your C++ advocacy in comp.lang.c. You're annoying the regulars, and confusing the OP. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o .
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2020-01-07 11:12 +0100 |
| Message-ID | <qv1lik$358$1@news.albasani.net> |
| In reply to | #148828 |
> You're annoying the regulars, ... They're using an annoying language anyway.
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2020-01-07 11:09 +0000 |
| Message-ID | <mFZQF.477$y87.156@fx25.am4> |
| In reply to | #148824 |
On 07/01/2020 07:03, Bonita Montero wrote:
> Use C++!
> With that you can have both:
>
> #include <vector>
> #include <stdexcept>
>
> template<typename T, typename Alloc = std::allocator<T>>
> struct pascal_vector : public std::vector<T, Alloc>
> {
> using std::vector<T, Alloc>::vector;
> reference at( size_type i );
> const_reference at( size_type i ) const;
> reference operator []( size_type i );
> const_reference operator []( size_type i ) const;
> };
>
> template<typename T, typename Alloc>
> inline
> typename pascal_vector<T, Alloc>::reference pascal_vector<T, Alloc>::at(
> size_type i )
> {
> if( i < 1 )
> throw std::out_of_range( "zero index!" );
> return at( i - 1 );
> }
>
> template<typename T, typename Alloc>
> inline
> typename pascal_vector<T, Alloc>::const_reference pascal_vector<T,
> Alloc>::at( size_type i ) const
> {
> if( i < 1 )
> throw std::out_of_range( "zero index!" );
> return at( i - 1 );
> }
>
> template<typename T, typename Alloc>
> inline
> typename pascal_vector<T, Alloc>::reference pascal_vector<T,
> Alloc>::operator []( size_type i )
> {
> return vector::operator []( i - 1 );
> }
>
> template<typename T, typename Alloc>
> inline
> typename pascal_vector<T, Alloc>::const_reference pascal_vector<T,
> Alloc>::operator []( size_type i ) const
> {
> return vector::operator []( i - 1 );
> }
You seriously need all that just to use a non-zero lower bound? Where is
the array actually being defined; what is it called? Or is that bit not
even in the code?!
That's rather a crucial detail - how the hell do you use it.
Now, I can't advocate using my language, because it's not public. But it
can show how to used non-zero-based arrays painlessly:
[10]int A # Array bounds 1..10 inclusive (default)
[1..10]int B # Same thing, but explicit this time
[0..9]int C # C-style zero lower bound
[0:10]int D # lower bound and length
['A'..'Z']int E # Not limited to 0 or 1 either
I'm sorry but for some things, it's so easy to wipe the floor with C++!
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2020-01-07 13:45 +0100 |
| Message-ID | <qv1ugf$aua$1@news.albasani.net> |
| In reply to | #148830 |
> I'm sorry but for some things, it's so easy to wipe the floor with C++! You don't understand the flexibility of the C++-code as you're not familiar with C++.
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2020-01-07 13:06 +0000 |
| Message-ID | <Mn%QF.574$iK5.44@fx34.am4> |
| In reply to | #148834 |
On 07/01/2020 12:45, Bonita Montero wrote: >> I'm sorry but for some things, it's so easy to wipe the floor with C++! > > You don't understand the flexibility of the C++-code as you're not > familiar with C++. I understand the flexibility means you have to take a DIY approach - ie. write your own compiler, pretty much - to do things you expect to be taken care of for you. I've taken N-based arrays for granted for so long (now 40 years...), I was surprised when I found out that C++ didn't support them natively. C I know uses 0-based, since it's just a crude language that it defines array indexing in terms of pointer offsets which necessarily need to be 0-based).
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2020-01-07 14:14 +0100 |
| Message-ID | <qv206p$6or$1@news.albasani.net> |
| In reply to | #148837 |
> I've taken N-based arrays for granted for so long (now 40 years...), I > was surprised when I found out that C++ didn't support them natively. The need is simply nearly non-existing. > C I know uses 0-based, since it's just a crude language that it defines > array indexing in terms of pointer offsets which necessarily need to be > 0-based). That's not crude but close to how the machine works.
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2020-01-07 16:27 +0000 |
| Message-ID | <6k2RF.9736$7i5.2879@fx35.am4> |
| In reply to | #148838 |
On 07/01/2020 13:14, Bonita Montero wrote: >> I've taken N-based arrays for granted for so long (now 40 years...), I >> was surprised when I found out that C++ didn't support them natively. > > The need is simply nearly non-existing. Yeah, like every time you want to implement an algorithm that assumes 1-based, or translate it from a language that uses 1-based. But a language that can use any base can be used to code either kind of algorithm without mods and without assorted off-by-one bugs.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2020-01-07 17:53 +0100 |
| Message-ID | <qv2d2n$7vl$1@news.albasani.net> |
| In reply to | #148847 |
> Yeah, like every time you want to implement an algorithm that assumes > 1-based, or translate it from a language that uses 1-based. For those algorithms there are always zero-based variants, f.e. when you want to have a binary heap. When you have zero-based indexing, the descendents are indexed 2i+1 and 2i+2, when you have one-based indexing, the descentents are at 2i and 2i+1. > But a language that can use any base can be used to code either kind > of algorithm without mods and without assorted off-by-one bugs. Having one insignificant advantage doesn't mean you have a better language.
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.arthur.mclean@gmail.com> |
|---|---|
| Date | 2020-01-07 08:55 -0800 |
| Message-ID | <bdb5fbd0-578d-4d99-938f-0839604c52ef@googlegroups.com> |
| In reply to | #148847 |
On Tuesday, 7 January 2020 16:27:55 UTC, Bart wrote: > On 07/01/2020 13:14, Bonita Montero wrote: > >> I've taken N-based arrays for granted for so long (now 40 years...), I > >> was surprised when I found out that C++ didn't support them natively. > > > > The need is simply nearly non-existing. > > Yeah, like every time you want to implement an algorithm that assumes > 1-based, or translate it from a language that uses 1-based. > > But a language that can use any base can be used to code either kind of > algorithm without mods and without assorted off-by-one bugs. > However, if you support both conventions, then both conventions will be used.
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.arthur.mclean@gmail.com> |
|---|---|
| Date | 2020-01-07 05:19 -0800 |
| Message-ID | <0b5a487f-d703-4c1d-8d56-b05d1190a523@googlegroups.com> |
| In reply to | #148830 |
On Tuesday, 7 January 2020 11:09:15 UTC, Bart wrote:
> On 07/01/2020 07:03, Bonita Montero wrote:
> > Use C++!
> > With that you can have both:
> >
> > #include <vector>
> > #include <stdexcept>
> >
> > template<typename T, typename Alloc = std::allocator<T>>
> > struct pascal_vector : public std::vector<T, Alloc>
> > {
> > using std::vector<T, Alloc>::vector;
> > reference at( size_type i );
> > const_reference at( size_type i ) const;
> > reference operator []( size_type i );
> > const_reference operator []( size_type i ) const;
> > };
> >
> > template<typename T, typename Alloc>
> > inline
> > typename pascal_vector<T, Alloc>::reference pascal_vector<T, Alloc>::at(
> > size_type i )
> > {
> > if( i < 1 )
> > throw std::out_of_range( "zero index!" );
> > return at( i - 1 );
> > }
> >
> > template<typename T, typename Alloc>
> > inline
> > typename pascal_vector<T, Alloc>::const_reference pascal_vector<T,
> > Alloc>::at( size_type i ) const
> > {
> > if( i < 1 )
> > throw std::out_of_range( "zero index!" );
> > return at( i - 1 );
> > }
> >
> > template<typename T, typename Alloc>
> > inline
> > typename pascal_vector<T, Alloc>::reference pascal_vector<T,
> > Alloc>::operator []( size_type i )
> > {
> > return vector::operator []( i - 1 );
> > }
> >
> > template<typename T, typename Alloc>
> > inline
> > typename pascal_vector<T, Alloc>::const_reference pascal_vector<T,
> > Alloc>::operator []( size_type i ) const
> > {
> > return vector::operator []( i - 1 );
> > }
>
>
> You seriously need all that just to use a non-zero lower bound? Where is
> the array actually being defined; what is it called? Or is that bit not
> even in the code?!
>
> That's rather a crucial detail - how the hell do you use it.
>
He's deriving a pascal_vector from an std::vector. The std::vector is
a templated class which takes two template arguments, the type of the
array element and, optionally and rarely used, the allocator.
You use like an std::vector, except that you pass in 1 for the first
element position and N for the last element position.
However the templates require some pretty confusing code. It's not at
all obvious what is going on unless you are familiar with template
programming.
> Now, I can't advocate using my language, because it's not public. But it
> can show how to used non-zero-based arrays painlessly:
>
> [10]int A # Array bounds 1..10 inclusive (default)
> [1..10]int B # Same thing, but explicit this time
> [0..9]int C # C-style zero lower bound
> [0:10]int D # lower bound and length
> ['A'..'Z']int E # Not limited to 0 or 1 either
>
> I'm sorry but for some things, it's so easy to wipe the floor with C++!
>
If you are writing a language from scratch, you can include support
for 1-based or arbitrary based arrays. The argument for 1-based arrays is that
it is mathematical convention, the argument for 0 based arrays is that it
coverts more naturally to machine code. The argument for an arbitrary base
is that if you provide an option for 0 and 1, it's easy to tweak the grammar
to allow for any integer constant. The argument against providing options
is that it becomes more difficult to follow code, because you have to check
where the array is declared to ensure that the index base is right.
However it's not worth writing a language from scratch just to get the
array convention you prefer.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2020-01-11 19:11 +0100 |
| Message-ID | <qvd33m$n6l$1@news.albasani.net> |
| In reply to | #148830 |
> Now, I can't advocate using my language, because it's not public. But it
> can show how to used non-zero-based arrays painlessly:
>
> [10]int A # Array bounds 1..10 inclusive (default)
> [1..10]int B # Same thing, but explicit this time
> [0..9]int C # C-style zero lower bound
> [0:10]int D # lower bound and length
> ['A'..'Z']int E # Not limited to 0 or 1 either
>
> I'm sorry but for some things, it's so easy to wipe the floor with C++!
Here, look at this. This is a little window-class that allows
any offsetted access to a vector, array, string or whatever
what has a radom-access-iterator - for total confusion !
#include <iostream>
#include <cstddef>
#include <iterator>
#include <cassert>
#include <stdexcept>
#include <vector>
template<typename Iterator>
struct window
{
using T = typename std::iterator_traits<Iterator>::value_type;
window( Iterator itBegin, Iterator itEnd, std::ptrdiff_t
offset );
template<typename Alloc>
window( std::vector<T, Alloc> &vec, std::ptrdiff_t offset );
T &operator []( std::ptrdiff_t i );
T &at( std::ptrdiff_t i );
Iterator begin();
Iterator end();
private:
Iterator m_itBase;
Iterator m_itBegin,
m_itEnd;
};
template<typename Iterator>
inline
window<Iterator>::window( Iterator itBegin, Iterator itEnd,
std::ptrdiff_t offset )
{
m_itBase = itBegin + offset;
m_itBegin = itBegin,
m_itEnd = itEnd;
}
template<typename Iterator>
template<typename Alloc>
inline
window<Iterator>::window( std::vector<T, Alloc> &vec, std::ptrdiff_t
offset )
{
m_itBase = vec.begin() + offset;
m_itBegin = vec.begin(),
m_itEnd = vec.end();
}
template<typename Iterator>
inline
typename window<Iterator>::T &window<Iterator>::operator [](
std::ptrdiff_t i )
{
assert(m_itBase + i >= m_itBegin);
assert(m_itBase + i < m_itEnd);
return m_itBase[i];
}
template<typename Iterator>
inline
typename window<Iterator>::T &window<Iterator>::at( std::ptrdiff_t i )
{
if( m_itBase + i < m_itBegin ||
m_itBase + i >= m_itEnd )
throw std::out_of_range( "window-index out of range" );
return m_itBase[i];
}
template<typename Iterator>
inline
Iterator window<Iterator>::begin()
{
return m_itBegin;
}
template<typename Iterator>
inline
Iterator window<Iterator>::end()
{
return m_itEnd;
}
#include <vector>
using namespace std;
int main()
{
vector<int> vi( 1'000, 0 );
using VIW = window<vector<int>::iterator>;
VIW w100( vi, 100 );
VIW w200( vi, 200 );
w100[200] = 223;
w200[100] = 656;
}
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2020-01-11 19:09 +0000 |
| Message-ID | <f4pSF.98760$Cv1.56800@fx13.am4> |
| In reply to | #148940 |
On 11/01/2020 18:11, Bonita Montero wrote:
>> Now, I can't advocate using my language, because it's not public. But
>> it can show how to used non-zero-based arrays painlessly:
>>
>> [10]int A # Array bounds 1..10 inclusive (default)
>> [1..10]int B # Same thing, but explicit this time
>> [0..9]int C # C-style zero lower bound
>> [0:10]int D # lower bound and length
>> ['A'..'Z']int E # Not limited to 0 or 1 either
>>
>> I'm sorry but for some things, it's so easy to wipe the floor with C++!
>
> Here, look at this. This is a little window-class that allows
> any offsetted access to a vector, array, string or whatever
> what has a radom-access-iterator - for total confusion !
<Lots of template code elided>
> vector<int> vi( 1'000, 0 );
> using VIW = window<vector<int>::iterator>;
> VIW w100( vi, 100 );
> VIW w200( vi, 200 );
> w100[200] = 223;
> w200[100] = 656;
> }
The first task for me was to figure out what the hell this does.
Experimenting with this version:
vector<int> vi( 50, 0 );
using VIW = window<vector<int>::iterator>;
VIW w10( vi, 10 );
w10[0] = 223;
for (int i=0; i<50; ++i) {
std::cout << i << " " << vi[i] << std::endl;
}
suggested that, first, a conventional vector 'vi' is created, of length
50, indexed as normal from 0 to 49. Then w10 is created as the slice
vi[10..49], of length 40, which is indexed from 0 to 39.
But, wait ... the idea had been to index from something not zero, and
here the slice is being indexed from 0! Except that it is mapped into vi
starting from 10.
How can these be used to implement my 'A'..'Z' example which is index
from 65 to 90? I tried:
vector<int> vi( 'Z'-'A'+1, 0 );
using VIW = window<vector<int>::iterator>;
VIW waz( vi, 'A' );
waz['X'] = 777;
for (int i='A'; i<='Z'; ++i) {
printf("'%c' = %d\n", waz[i]);
}
But this fails. It seems that waz must be created like this:
VIW waz( vi, -'A');
Notice the negative -'A' value. This applies an offset so as to change
indices of waz from, say, 65 to 90, into the range 0 to 25, which
correspedonds to default indexing for vi. This not very friendly.
BTW I do slices like this (in a static language here, not dynamic):
[1000]int A
slice[]int W := A[200..300]
println A.lwb, A.upb
println W.lwb, W.upb
Output is:
1 1000
1 101
since slices here have their own bounds that start from 1. (To index the
slice from 200, I can make that part of the type:
slice[200:]int W := A[200..300]
and output becomes:
1 1000
200 300
But the '200' must be a compile time value; there are no run-time lower
bounds. Alternatively, take a slice to the whole array:
W := A
Then index as 200..300, but the bounds of S will be 1..1000; it's not
really a subarray of A.)
A good effort with C++ but my language still deals with this stuff
effortlessly and more intuitively.
[toc] | [prev] | [next] | [standalone]
Page 4 of 10 — ← Prev page 1 2 3 [4] 5 6 … 10 Next page →
Back to top | Article view | comp.lang.c
csiph-web