Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #396684 > unrolled thread

Sort of trivial code challenge - may be interesting to you anyway

Started byDFS <nospam@dfs.com>
First post2026-02-19 16:55 -0500
Last post2026-03-16 09:04 +0100
Articles 20 on this page of 218 — 21 participants

Back to article view | Back to comp.lang.c


Contents

  Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-02-19 16:55 -0500
    Re: Sort of trivial code challenge - may be interesting to you anyway jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-02-25 15:56 -0500
      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-02-26 10:05 -0500
        Re: Sort of trivial code challenge - may be interesting to you anyway jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-02-26 13:20 -0500
    Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 17:06 +0000
      Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 17:27 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-02-26 14:31 -0500
      Re: Sort of trivial code challenge - may be interesting to you anyway jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-02-26 13:33 -0500
        Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 18:49 +0000
          Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 18:55 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 19:17 +0000
      Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 19:34 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-02-26 20:01 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 10:36 -0500
          Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 17:38 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 17:48 +0000
    Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-02-27 00:12 +0000
      [OT] Bart's scripting language solution (was Re: Sort of trivial code challenge - may be interesting to you anyway) Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-06 06:37 +0100
        Re: [OT] Bart's scripting language solution (was Re: Sort of trivial code challenge - may be interesting to you anyway) Bart <bc@freeuk.com> - 2026-03-06 15:48 +0000
          Re: [OT] Bart's scripting language solution (was Re: Sort of trivial code challenge - may be interesting to you anyway) Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-06 18:17 +0100
            Re: [OT] Bart's scripting language solution (was Re: Sort of trivial code challenge - may be interesting to you anyway) Bart <bc@freeuk.com> - 2026-03-06 21:46 +0000
    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-02 00:44 -0800
      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-02 11:07 +0200
        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-02 06:35 -0800
          Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-02 17:50 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-02 21:15 -0800
              Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-03 20:48 +0000
                Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-03-03 22:47 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-04 08:48 +0100
                    Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-04 01:07 -0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-04 12:09 +0200
                        Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-04 11:19 -0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-04 12:58 +0100
                        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:31 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-04 13:20 +0000
                Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 08:30 -0500
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-04 14:36 +0000
                    Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 10:02 -0500
                      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-04 19:27 +0200
                        Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 13:49 -0500
                          Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-05 21:02 +0200
                          Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-05 20:39 +0000
                            Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 19:24 -0500
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 13:54 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-12 05:50 -0700
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-13 11:58 +0000
                    Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-13 23:00 +0000
                      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-15 15:54 -0700
                        Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-15 23:42 +0000
                          Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-06 12:02 -0700
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-15 15:43 -0700
      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-02 17:40 -0500
        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-02 21:09 -0800
          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-03 08:23 -0500
            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-03 06:20 -0800
              Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-03 23:56 +0200
                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-03 15:51 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-04 11:45 +0200
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-04 07:01 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:37 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 08:29 -0500
                Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-03-04 16:02 +0100
                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-04 08:09 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 10:34 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-06 08:46 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-04 11:25 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 13:46 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-05 21:34 +0100
          Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-05 19:09 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-05 21:12 +0000
              Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 14:12 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-05 22:24 +0000
                  Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-06 01:00 +0200
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 15:08 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 15:05 -0800
              Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-06 00:18 +0100
                Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-07 22:04 +0200
                  Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 00:26 +0100
                    Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-08 02:45 +0200
                      Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 17:05 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 07:57 -0700
              Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 00:12 +0000
                Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 00:14 +0000
                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 20:31 -0800
                  Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-06 13:51 +0000
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-06 08:53 -0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 19:36 -0500
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-06 18:14 -0800
                    Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-07 18:21 +0000
                      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-07 11:55 -0800
                        Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-07 20:10 +0000
                          Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 10:44 -0700
                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-07 12:02 -0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-07 20:14 +0000
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 10:53 -0700
                      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-07 16:58 -0500
                        Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-08 00:35 +0200
                          Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 08:23 -0700
                        Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 00:40 +0100
                          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-08 10:42 -0400
                            Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-08 15:18 +0000
                              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-08 12:21 -0400
                                Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-08 19:29 +0000
                                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-09 21:20 -0400
                                    Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-10 14:43 +0000
                                      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-10 18:08 +0200
                                        Re: Sort of trivial code challenge - may be interesting to you anyway Giovanni <lsodgf0@home.net.it> - 2026-03-10 17:18 +0100
                                        Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-10 16:32 +0000
                                      Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-10 15:25 -0700
                                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 07:07 -0700
                                          Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-11 13:49 -0700
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-10 20:24 +0000
                                      Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-10 15:29 -0700
                                        Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-11 00:29 +0000
                                        Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-11 00:33 +0000
                                          Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-11 11:04 +0000
                                  Re: Sort of trivial code challenge - may be interesting to you anyway antispam@fricas.org (Waldek Hebisch) - 2026-03-10 20:18 +0000
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-12 05:37 -0700
                              Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 17:57 +0100
                              Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-08 13:19 -0700
                                Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-09 01:12 +0000
                              Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-08 21:42 +0000
                                Re: Sort of trivial code challenge - may be interesting to you anyway "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-03-08 15:58 -0700
                                  Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-09 08:09 +0100
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-09 08:53 +0100
                                    Re: Sort of trivial code challenge - may be interesting to you anyway "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-03-09 15:25 -0700
                                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 14:40 -0700
                              Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-12 05:55 -0700
                            Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-08 16:00 +0000
                              Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 12:44 -0700
                            Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 17:36 +0100
                            Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-08 13:27 -0700
                            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 06:33 -0700
                        Re: Sort of trivial code challenge - may be interesting to you anyway David Brown <david.brown@hesbynett.no> - 2026-03-08 12:22 +0100
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 06:27 -0700
                      Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-07 16:43 -0800
                        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-11 07:29 -0700
                          Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-11 14:22 -0700
                            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-25 10:07 -0700
                              Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-04-25 15:54 -0700
                                Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-30 03:13 -0700
                Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-06 16:02 +0000
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 12:11 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 13:01 -0500
                      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 13:28 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-06 21:53 +0000
                      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-06 22:14 -0500
                        Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-07 07:33 +0100
                          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-07 10:24 -0500
                            Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-07 19:16 +0100
                              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-07 14:18 -0500
                                Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-08 00:47 +0100
                                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-09 22:18 -0400
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Richard Harnden <richard.nospam@gmail.invalid> - 2026-03-10 10:14 +0000
                                    Re: Sort of trivial code challenge - may be interesting to you anyway Richard Harnden <richard.nospam@gmail.invalid> - 2026-03-11 11:40 +0000
                        Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-07 13:33 +0000
                          Re: Sort of trivial code challenge - may be interesting to you anyway Richard Harnden <richard.nospam@gmail.invalid> - 2026-03-07 14:53 +0000
                            Re: Sort of trivial code challenge - may be interesting to you anyway Bart <bc@freeuk.com> - 2026-03-07 15:44 +0000
                            Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-07 19:53 +0200
                          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-07 10:22 -0500
                Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:40 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-11 11:00 -0400
                    Re: Sort of trivial code challenge - may be interesting to you anyway wij <wyniijj5@gmail.com> - 2026-03-12 00:00 +0800
                      Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 18:03 +0100
                        Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-11 17:52 +0000
                        Re: Sort of trivial code challenge - may be interesting to you anyway wij <wyniijj5@gmail.com> - 2026-03-12 23:14 +0800
                          Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-12 16:23 +0100
                          Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-12 16:11 -0700
            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 14:04 -0800
          Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:36 +0100
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-11 11:35 +0100
      Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-03 15:40 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-03 16:23 -0800
          Re: Sort of trivial code challenge - may be interesting to you anyway Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2026-03-04 15:31 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-04 09:38 -0800
    Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-03 16:39 +0100
      Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-03 12:00 -0500
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-04 11:44 +0100
          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 17:44 -0500
            Re: Sort of trivial code challenge - may be interesting to you anyway Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-04 15:13 -0800
              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-04 21:07 -0500
            Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-04 23:37 +0000
            Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 07:32 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 08:23 +0100
          Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 02:24 -0500
            Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 08:46 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 09:52 +0100
                Re: Sort of trivial code challenge - may be interesting to you anyway tTh <tth@none.invalid> - 2026-03-05 10:49 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 11:03 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway gazelle@shell.xmission.com (Kenny McCormack) - 2026-03-05 15:22 +0000
              Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 05:06 -0500
                Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 11:13 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway DFS <nospam@dfs.com> - 2026-03-05 14:11 -0500
                    Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-06 03:35 +0100
            Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-05 14:49 +0000
              Re: Sort of trivial code challenge - may be interesting to you anyway Janis Papanagnou <janis_papanagnou@hotmail.com> - 2026-03-05 19:27 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-05 19:46 +0100
                Re: Sort of trivial code challenge - may be interesting to you anyway tTh <tth@none.invalid> - 2026-03-05 20:50 +0100
                  Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-05 22:34 +0200
                  Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-06 07:48 +0100
                    Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-06 11:49 +0200
                      Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-06 13:41 +0100
                        Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-06 15:33 +0200
                          Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-06 14:42 +0100
              Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 13:49 -0800
                Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-06 02:17 +0000
                  Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-05 20:06 -0800
                    Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-06 14:58 +0000
                      Re: Sort of trivial code challenge - may be interesting to you anyway Michael S <already5chosen@yahoo.com> - 2026-03-06 17:13 +0200
                      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-06 08:37 -0800
      Re: Sort of trivial code challenge - may be interesting to you anyway scott@slp53.sl.home (Scott Lurndal) - 2026-03-03 17:29 +0000
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-03 19:20 +0100
      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-03 16:26 -0800
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-04 05:27 +0100
    Re: Sort of trivial code challenge - may be interesting to you anyway Opus <ifonly@youknew.org> - 2026-03-04 22:42 +0100
    Re: Sort of trivial code challenge - may be interesting to you anyway peter <peter.noreply@tin.it> - 2026-03-14 10:42 +0100
      Re: Sort of trivial code challenge - may be interesting to you anyway Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-15 15:09 -0700
        Re: Sort of trivial code challenge - may be interesting to you anyway Bonita Montero <Bonita.Montero@gmail.com> - 2026-03-16 09:04 +0100

Page 9 of 11 — ← Prev page 1 … 7 8 [9] 10 11  Next page →


#396897

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-11 11:40 +0100
Message-ID<10orgq8$10vbl$1@raubtier-asyl.eternal-september.org>
In reply to#396805
This code *really* sucks because it is too complicated for what is 
requested.

[toc] | [prev] | [next] | [standalone]


#396905

FromDFS <nospam@dfs.com>
Date2026-03-11 11:00 -0400
Message-ID<10os03a$15se5$1@dont-email.me>
In reply to#396897
On 3/11/2026 6:40 AM, Bonita Montero wrote:

 > This C-code looks really "naked" and too long for me.

and

> This code *really* sucks because it is too complicated for what is 
> requested.



Can't you quote who and what you're replying to?

[toc] | [prev] | [next] | [standalone]


#396907

Fromwij <wyniijj5@gmail.com>
Date2026-03-12 00:00 +0800
Message-ID<4b2d42ff4b75fd136782109d0250034300cd84af.camel@gmail.com>
In reply to#396905
On Wed, 2026-03-11 at 11:00 -0400, DFS wrote:
> On 3/11/2026 6:40 AM, wrote:
> 
>  > This C-code looks really "naked" and too long for me.
> 
> and
> 
> > This code *really* sucks because it is too complicated for what is 
> > requested.
> 

Most of the reason is that many people thought C is for their application
but not, C is for building portable OS. Try using C++ (or other language) to
write OS from bottom up to understand.

Your C++ codes are hard to read because C++ is good at expressing idea,
including good for making 'fantacy' codes looks professional (and others).
Comparing to C, your codes are overly abstract and heavily depends on 
libraries, Clib only contains those for building OS, nothing else.

For example, Qt-library is in many ways better than c++stdlib for many 
applications (from my little experience of Qt3). Also, I think my own library 
is 'essentially' better than C++stdlib (limited).
As I said, try write cp to know (I had heard, C++ cannot even implement cat)

> 
> Can't you quote who and what you're replying to?

I'm replying to Bonita Montero.

[toc] | [prev] | [next] | [standalone]


#396908

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-11 18:03 +0100
Message-ID<10os79k$196gc$1@raubtier-asyl.eternal-september.org>
In reply to#396907
Am 11.03.2026 um 17:00 schrieb wij:

> Most of the reason is that many people thought C is for their application
> but not, C is for building portable OS. Try using C++ (or other language)
> to write OS from bottom up to understand.

That's a very limited view. This would work even better in C++, but
switching from the lowlevel to the medium level abstraction layers
is too much for kernel hackers. Haiku f.e. is written completely
in C++. OOP along with generic and functional saves a great amount
of work.

> Your C++ codes are hard to read because C++ is good at expressing idea,

My code is *much* easier to read if you know C++.

> Comparing to C, your codes are overly abstract and heavily depends
> on libraries, Clib only contains those for building OS, nothing else.

The abstaction is rather simple and relying on the runtime isn't
a problem since it saves a lot of work; not much with this example
but usually C++ code is a fifth of the same functionality in C.

> For example, Qt-library is in many ways better than c++stdlib for many
> applications (from my little experience of Qt3).

Absolutely not. F.e. consider the threading support, it's much more
complicated to spawn a new thread in Qt. And Qt has no exceptions
for historical reasons which makes much more work to handle errors.
Qt is simply not modern C++.

> Also, I think my own library is 'essentially' better than C++stdlib (limited).

It's more code and if you know C++ it's less readable. C really sucks.
Image using sth. like a map<> or unordered_map<> in C. Even with a call-
back'd library (like qsort()) that's a big amout of work. Or consider
just having a vector of strings; a stringVec.emplace_back( "hello" )
is hours of work if you implement the same size() / capacity() manage-
ment. In C you've write much code and flip the bits yourself where in
C++ you write only one line of code.
It's all o.k. if your project is historically C or you don't have a
C++ compiler for the target platform, otherwise you have multiple
times the work as in C++.


[toc] | [prev] | [next] | [standalone]


#396910

Fromscott@slp53.sl.home (Scott Lurndal)
Date2026-03-11 17:52 +0000
Message-ID<ZZhsR.226243$wcP9.206775@fx24.iad>
In reply to#396908
Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 11.03.2026 um 17:00 schrieb wij:
>
>> Most of the reason is that many people thought C is for their application
>> but not, C is for building portable OS. Try using C++ (or other language)
>> to write OS from bottom up to understand.
>
>That's a very limited view. This would work even better in C++, but
>switching from the lowlevel to the medium level abstraction layers
>is too much for kernel hackers. Haiku f.e. is written completely

While it is de rigueur auf Deutsch to abbreviate zum beispiel as z.b.,
in English one generally uses the latin abbreviation 'e.g.'

[toc] | [prev] | [next] | [standalone]


#396930

Fromwij <wyniijj5@gmail.com>
Date2026-03-12 23:14 +0800
Message-ID<3691b0d9f7b7f62a3931a8ac970bce521da99bec.camel@gmail.com>
In reply to#396908
On Wed, 2026-03-11 at 18:03 +0100, Bonita Montero wrote:
> Am 11.03.2026 um 17:00 schrieb wij:
> 
> > Most of the reason is that many people thought C is for their application
> > but not, C is for building portable OS. Try using C++ (or other language)
> > to write OS from bottom up to understand.
> 
> That's a very limited view. This would work even better in C++, but
> switching from the lowlevel to the medium level abstraction layers
> is too much for kernel hackers. Haiku f.e. is written completely
> in C++. OOP along with generic and functional saves a great amount
> of work.

It looks to me Haiku is a 're-name' (not much different) of C? what's special?
https://www.haiku-os.org/documents/dev/hello_kernel_you_have_a_syscall_from_userland/


> > Your C++ codes are hard to read because C++ is good at expressing idea,
> 
> My code is *much* easier to read if you know C++.
> 
> > Comparing to C, your codes are overly abstract and heavily depends
> > on libraries, Clib only contains those for building OS, nothing else.
> 
> The abstaction is rather simple and relying on the runtime isn't
> a problem since it saves a lot of work; not much with this example
> but usually C++ code is a fifth of the same functionality in C.
> 
> > For example, Qt-library is in many ways better than c++stdlib for many
> > applications (from my little experience of Qt3).
> 
> Absolutely not. F.e. consider the threading support, it's much more
> complicated to spawn a new thread in Qt. And Qt has no exceptions
> for historical reasons which makes much more work to handle errors.
> Qt is simply not modern C++.
> 
> > Also, I think my own library is 'essentially' better than C++stdlib (limited).
> 
> It's more code and if you know C++ it's less readable. C really sucks.
> Image using sth. like a map<> or unordered_map<> in C. Even with a call-
> back'd library (like qsort()) that's a big amout of work. Or consider
> just having a vector of strings; a stringVec.emplace_back( "hello" )
> is hours of work if you implement the same size() / capacity() manage-
> ment. In C you've write much code and flip the bits yourself where in
> C++ you write only one line of code.
> It's all o.k. if your project is historically C or you don't have a
> C++ compiler for the target platform, otherwise you have multiple
> times the work as in C++.
> 

In all, write cp using your favorite standard C++. I think sketching the plan 
already difficult for you.


[toc] | [prev] | [next] | [standalone]


#396932

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-12 16:23 +0100
Message-ID<10oulpd$24caa$1@raubtier-asyl.eternal-september.org>
In reply to#396930
Am 12.03.2026 um 16:14 schrieb wij:

> It looks to me Haiku is a 're-name' (not much different) of C? what's special?
> https://www.haiku-os.org/documents/dev/hello_kernel_you_have_a_syscall_from_userland/

Haiku is the open-source derivate from BeOS.

> In all, write cp using your favorite standard C++. I think sketching the plan
> already difficult for you.

This has not much to do with the statement that programming
large apps is easier in C++.

[toc] | [prev] | [next] | [standalone]


#396942

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2026-03-12 16:11 -0700
Message-ID<87qzpo1w3w.fsf@example.invalid>
In reply to#396930
wij <wyniijj5@gmail.com> writes:
> On Wed, 2026-03-11 at 18:03 +0100, Bonita Montero wrote:
>> Am 11.03.2026 um 17:00 schrieb wij:
>> > Most of the reason is that many people thought C is for their application
>> > but not, C is for building portable OS. Try using C++ (or other language)
>> > to write OS from bottom up to understand.
>> 
>> That's a very limited view. This would work even better in C++, but
>> switching from the lowlevel to the medium level abstraction layers
>> is too much for kernel hackers. Haiku f.e. is written completely
>> in C++. OOP along with generic and functional saves a great amount
>> of work.
>
> It looks to me Haiku is a 're-name' (not much different) of C? what's special?
> https://www.haiku-os.org/documents/dev/hello_kernel_you_have_a_syscall_from_userland/
[...]

Haiku is an operating system.  C is a language.  Can you explain
how your statement makes sense?

(The Haiku git repo contains a number of C and C++ source files.
I haven't investigated further.)

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


#396798

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2026-03-05 14:04 -0800
Message-ID<864imuc4qt.fsf@linuxsc.com>
In reply to#396789
Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:

> On Mon, 02 Mar 2026 21:09:21 -0800, Tim Rentsch wrote:
> [snip]
>
>> The latest challenge, which I just got through doing, is to
>> disallow if, for, while, goto, return, and to forbid functions
>> and function calls except for calls to C standard library
>> functions.  Also no math library. :)
>
> Inventive, aren't you :-)

Yes I do enjoy looking at alternative approaches.  Guilty as
charged. :)

> I've got a working matrix print that (I think) satisfies your
> requirements, but have not started on the argument processing
> logic yet.  I may, yet again, revise my approach, as the solution
> I'm using is quite tedious to code.

Yeah, argument processing is a bitch, especially if you want to
guard against malformed invocations.  It's vaguely satisfying to
find an approach that doesn't suck.

>> The program is a bit on the long side because of argument
>> processing but the matrix print code is less than 20 lines,
>> including 5 blank lines.
>
> 20 lines, including 4 blank lines, but I can reduce it a bit.
> I should be able to match (or at least approximate) your line
> count.

I've just gone through my first (and probably last) rewrite, and
the result is a lot cleaner.  I won't say more just now, and let
you continue on your current path.

[toc] | [prev] | [next] | [standalone]


#396895

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-11 11:36 +0100
Message-ID<10orgj8$10om3$3@raubtier-asyl.eternal-september.org>
In reply to#396733
Am 03.03.2026 um 06:09 schrieb Tim Rentsch:

> Unfortunately the two functions generate() and validate() are
> mutually recursive.  They may be optimized to use tail-call
> elimination, but at the source level they are recursive.

Performance doesn't count if you print to the console, which is
a kernel-flush.

[toc] | [prev] | [next] | [standalone]


#396894

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-11 11:35 +0100
Message-ID<10orggi$10om3$2@raubtier-asyl.eternal-september.org>
In reply to#396730
This C-code looks really "naked" and too long for me.

[toc] | [prev] | [next] | [standalone]


#396738

FromLew Pitcher <lew.pitcher@digitalfreehold.ca>
Date2026-03-03 15:40 +0000
Message-ID<10o6vdo$23hp3$3@dont-email.me>
In reply to#396724
On Mon, 02 Mar 2026 00:44:57 -0800, Tim Rentsch wrote:

> DFS <nospam@dfs.com> writes:
> 
>> Challenge is to output sequential numbers by column then row:
>>
>> 1   6  11  16  21
>> 2   7  12  17  22
>> 3   8  13  18  23
>> 4   9  14  19  24
>> 5  10  15  20  25
> 
> [...]
> 
>> Simple enough.  But the following 2 requirements take it from trivial
>> to less trivial!
>>
>> --------------------------------------------------------------------
>> 1) must be able to cut the output off at any arbitrary value
>>    lower than rows x columns
>> --------------------------------------------------------------------
> 
> [...]
> 
>> --------------------------------------------------------------------
>> 2) if you don't specify rows and columns, your solution must try
>>    to calculate them to form a square (same # of rows and columns)
>>    that includes only 1 to N.
>>
>>    If rows=columns can't be calculated, return message 'not possible'
>> --------------------------------------------------------------------
> 
> A straightfoward exercise.  Here is a counter challenge to make
> things more interesting:  as above, but don't use nested loops
> (or goto's, etc).

So, instead of my
    for (unsigned int row = 0; row < n_rows; ++row)
    {
      for (unsigned int col = 0; col < n_cols; ++col)
      {
        unsigned int valu = 1 + row + (col * n_rows);
        if (valu <= cut_off)
          printf(" %*u",field_width,valu);
      }
      putchar('\n');
    }
use...
  int max = n_rows * n_cols;

  for (unsigned int count = 0; count < max; ++count)
  {
    unsigned int row, col, valu;

    col = count % n_cols;
    row = count / n_cols;
    valu = 1 + row + (col * n_rows);

    if (valu <= cut_off) printf(" %*u",field_width,valu);

    if (col == n_cols-1) putchar('\n');
  }


-- 
Lew Pitcher
"In Skills We Trust"
Not LLM output - I'm just like this.

[toc] | [prev] | [next] | [standalone]


#396746

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2026-03-03 16:23 -0800
Message-ID<86y0k8cuhx.fsf@linuxsc.com>
In reply to#396738
Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:

> On Mon, 02 Mar 2026 00:44:57 -0800, Tim Rentsch wrote:
>
>> DFS <nospam@dfs.com> writes:
>>
>>> Challenge is to output sequential numbers by column then row:
>>>
>>> 1   6  11  16  21
>>> 2   7  12  17  22
>>> 3   8  13  18  23
>>> 4   9  14  19  24
>>> 5  10  15  20  25
>>
>> [...]
>>
>>> Simple enough.  But the following 2 requirements take it from trivial
>>> to less trivial!
>>>
>>> --------------------------------------------------------------------
>>> 1) must be able to cut the output off at any arbitrary value
>>>    lower than rows x columns
>>> --------------------------------------------------------------------
>>
>> [...]
>>
>>> --------------------------------------------------------------------
>>> 2) if you don't specify rows and columns, your solution must try
>>>    to calculate them to form a square (same # of rows and columns)
>>>    that includes only 1 to N.
>>>
>>>    If rows=columns can't be calculated, return message 'not possible'
>>> --------------------------------------------------------------------
>>
>> A straightfoward exercise.  Here is a counter challenge to make
>> things more interesting:  as above, but don't use nested loops
>> (or goto's, etc).
>
> So, instead of my
>     for (unsigned int row = 0; row < n_rows; ++row)
>     {
>       for (unsigned int col = 0; col < n_cols; ++col)
>       {
>         unsigned int valu = 1 + row + (col * n_rows);
>         if (valu <= cut_off)
>           printf(" %*u",field_width,valu);
>       }
>       putchar('\n');
>     }
> use...
>   int max = n_rows * n_cols;
>
>   for (unsigned int count = 0; count < max; ++count)
>   {
>     unsigned int row, col, valu;
>
>     col = count % n_cols;
>     row = count / n_cols;
>     valu = 1 + row + (col * n_rows);
>
>     if (valu <= cut_off) printf(" %*u",field_width,valu);
>
>     if (col == n_cols-1) putchar('\n');
>   }

Right.  Except for minor differences in spacing, this code
gives the same output as your original.

One glitch:  when the cutoff is less than the number of
rows, this code behaves differently than what DFS prescribes,
as can be seen by an example in his original posting.  (The
original code also.)

[toc] | [prev] | [next] | [standalone]


#396762

FromLew Pitcher <lew.pitcher@digitalfreehold.ca>
Date2026-03-04 15:31 +0000
Message-ID<10o9j90$313fd$1@dont-email.me>
In reply to#396746
On Tue, 03 Mar 2026 16:23:54 -0800, Tim Rentsch wrote:

> Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
> 
>> On Mon, 02 Mar 2026 00:44:57 -0800, Tim Rentsch wrote:
>>
>>> DFS <nospam@dfs.com> writes:
>>>
>>>> Challenge is to output sequential numbers by column then row:
>>>>
>>>> 1   6  11  16  21
>>>> 2   7  12  17  22
>>>> 3   8  13  18  23
>>>> 4   9  14  19  24
>>>> 5  10  15  20  25
>>>
>>> [...]
>>>
>>>> Simple enough.  But the following 2 requirements take it from trivial
>>>> to less trivial!
>>>>
>>>> --------------------------------------------------------------------
>>>> 1) must be able to cut the output off at any arbitrary value
>>>>    lower than rows x columns
>>>> --------------------------------------------------------------------
>>>
>>> [...]
>>>
>>>> --------------------------------------------------------------------
>>>> 2) if you don't specify rows and columns, your solution must try
>>>>    to calculate them to form a square (same # of rows and columns)
>>>>    that includes only 1 to N.
>>>>
>>>>    If rows=columns can't be calculated, return message 'not possible'
>>>> --------------------------------------------------------------------
>>>
>>> A straightfoward exercise.  Here is a counter challenge to make
>>> things more interesting:  as above, but don't use nested loops
>>> (or goto's, etc).
>>
>> So, instead of my
>>     for (unsigned int row = 0; row < n_rows; ++row)
>>     {
>>       for (unsigned int col = 0; col < n_cols; ++col)
>>       {
>>         unsigned int valu = 1 + row + (col * n_rows);
>>         if (valu <= cut_off)
>>           printf(" %*u",field_width,valu);
>>       }
>>       putchar('\n');
>>     }
>> use...
>>   int max = n_rows * n_cols;
>>
>>   for (unsigned int count = 0; count < max; ++count)
>>   {
>>     unsigned int row, col, valu;
>>
>>     col = count % n_cols;
>>     row = count / n_cols;
>>     valu = 1 + row + (col * n_rows);
>>
>>     if (valu <= cut_off) printf(" %*u",field_width,valu);
>>
>>     if (col == n_cols-1) putchar('\n');
>>   }
> 
> Right.  Except for minor differences in spacing, this code
> gives the same output as your original.

True enough. I've been fiddling with the column alignment;
the code I originally posted kept DFS' example left alignment,
but I prefer right alignment of numbers in columnar format.

The minor differences in spacing come from me not remembering
which version I posted. Mea culpa.

> One glitch:  when the cutoff is less than the number of
> rows, this code behaves differently than what DFS prescribes,
> as can be seen by an example in his original posting.  (The
> original code also.)

Right. I noticed that as well, but too late. I've modified my
code to conform to the "no blank lines" rule. However, I have
mutated the code from the original that I presented here,
what with conditional compilation and all, and will post it later.
My current code does not satisfy the later counter-challenge of
avoiding for()/do/do while()/goto/ and recursion. That's a
challenge that I have to think on ;-)

-- 
Lew Pitcher
"In Skills We Trust"
Not LLM output - I'm just like this.

[toc] | [prev] | [next] | [standalone]


#396765

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2026-03-04 09:38 -0800
Message-ID<86h5qvcx6f.fsf@linuxsc.com>
In reply to#396762
Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:

> On Tue, 03 Mar 2026 16:23:54 -0800, Tim Rentsch wrote:
>
>> Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>>
>>> On Mon, 02 Mar 2026 00:44:57 -0800, Tim Rentsch wrote:
>>>
>>>> DFS <nospam@dfs.com> writes:
>>>>
>>>>> Challenge is to output sequential numbers by column then row:
>>>>>
>>>>> 1   6  11  16  21
>>>>> 2   7  12  17  22
>>>>> 3   8  13  18  23
>>>>> 4   9  14  19  24
>>>>> 5  10  15  20  25
>>>>
>>>> [...]
>>>>
>>>>> Simple enough.  But the following 2 requirements take it from trivial
>>>>> to less trivial!
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> 1) must be able to cut the output off at any arbitrary value
>>>>>    lower than rows x columns
>>>>> --------------------------------------------------------------------
>>>>
>>>> [...]
>>>>
>>>>> --------------------------------------------------------------------
>>>>> 2) if you don't specify rows and columns, your solution must try
>>>>>    to calculate them to form a square (same # of rows and columns)
>>>>>    that includes only 1 to N.
>>>>>
>>>>>    If rows=columns can't be calculated, return message 'not possible'
>>>>> --------------------------------------------------------------------
>>>>
>>>> A straightfoward exercise.  Here is a counter challenge to make
>>>> things more interesting:  as above, but don't use nested loops
>>>> (or goto's, etc).
>>>
>>> So, instead of my
>>>     for (unsigned int row = 0; row < n_rows; ++row)
>>>     {
>>>       for (unsigned int col = 0; col < n_cols; ++col)
>>>       {
>>>         unsigned int valu = 1 + row + (col * n_rows);
>>>         if (valu <= cut_off)
>>>           printf(" %*u",field_width,valu);
>>>       }
>>>       putchar('\n');
>>>     }
>>> use...
>>>   int max = n_rows * n_cols;
>>>
>>>   for (unsigned int count = 0; count < max; ++count)
>>>   {
>>>     unsigned int row, col, valu;
>>>
>>>     col = count % n_cols;
>>>     row = count / n_cols;
>>>     valu = 1 + row + (col * n_rows);
>>>
>>>     if (valu <= cut_off) printf(" %*u",field_width,valu);
>>>
>>>     if (col == n_cols-1) putchar('\n');
>>>   }
>>
>> Right.  Except for minor differences in spacing, this code
>> gives the same output as your original.
>
> True enough.  I've been fiddling with the column alignment;
> the code I originally posted kept DFS' example left alignment,
> but I prefer right alignment of numbers in columnar format.

Yeah, me too.  Incidentally, I used a different way to determine
the field width to use, something like this:

    int field_width = snprintf( 0, 0, "%u", cutoff );

> The minor differences in spacing come from me not remembering
> which version I posted.  Mea culpa.

The change in spacing didn't bother me, I mentioned it only
out of a penchant for accuracy in my writing.

>> One glitch:  when the cutoff is less than the number of
>> rows, this code behaves differently than what DFS prescribes,
>> as can be seen by an example in his original posting.  (The
>> original code also.)
>
> Right.  I noticed that as well, but too late.  I've modified my
> code to conform to the "no blank lines" rule.  However, I have
> mutated the code from the original that I presented here,
> what with conditional compilation and all, and will post it later.
> My current code does not satisfy the later counter-challenge of
> avoiding for()/do/do while()/goto/ and recursion.  That's a
> challenge that I have to think on ;-)

That isn't hard once you see the basic technique, but it has its
own set of challenges that I think make it interesting.  I'm
looking forward to seeing your solution.  My first version is
kind of ugly, probably I will rewrite it before posting.

[toc] | [prev] | [next] | [standalone]


#396737

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-03 16:39 +0100
Message-ID<10o6vat$258sq$1@raubtier-asyl.eternal-september.org>
In reply to#396684
I think it's better to do that in C++ and not in C:

#include <iostream>
#include <thread>
#include <sstream>
#include <iomanip>

using namespace std;

static size_t parse( string_view str );

int main( int argc, char **argv )
{
	if( argc < 3 )
		return EXIT_FAILURE;
	size_t
		rows = parse( argv[1] ),
		cols = parse( argv[2] ),
		clip = rows * cols;
	if( argc >= 4 )
		clip = parse( argv[3] );
	if( (ptrdiff_t)rows < 0 || (ptrdiff_t)cols < 0 || (ptrdiff_t)clip < 0 )
		return EXIT_FAILURE;
	unsigned width = [&]
		{
			ostringstream oss;
			oss << clip;
			return oss.str().length();
		}();
	for( size_t row = 0; row < rows; ++row )
	{
		for( size_t col = 0; col < cols; ++col )
			if( size_t value = col * cols + row; value <= clip )
			{
				cout << right << setw( width ) << col * cols + row;
				if( value < clip && col < cols - 1 )
					cout << ", ";
			}
			else
				break;
		cout << endl;
	}
}

static size_t parse( string_view str )
{
	istringstream iss( (string( str )) );
	size_t ret;
	iss >> ret;
	return iss && iss.eof() ? ret : -1;
}

[toc] | [prev] | [next] | [standalone]


#396739

FromDFS <nospam@dfs.com>
Date2026-03-03 12:00 -0500
Message-ID<10o7438$2737q$2@dont-email.me>
In reply to#396737
On 3/3/2026 10:39 AM, Bonita Montero wrote:

> I think it's better to do that in C++ and not in C:


Disregarding your 0-base, a few fails:

./rc-montero 5 10
  0, 10, 20, 30, 40, 50
  1, 11, 21, 31, 41,
  2, 12, 22, 32, 42,
  3, 13, 23, 33, 43,
  4, 14, 24, 34, 44,

should print
   1   6  11  16  21  26  31  36  41  46
   2   7  12  17  22  27  32  37  42  47
   3   8  13  18  23  28  33  38  43  48
   4   9  14  19  24  29  34  39  44  49
   5  10  15  20  25  30  35  40  45  50


./rc-montero 5 100 10
  0,
  1,
  2,
  3,
  4,

should print:
   1   6
   2   7
   3   8
   4   9
   5  10


./rc-montero 1 100 3
0,

should print
1 2 3


./rc-montero 100 100 1
0,
1

(followed by 98 blank lines)




Note: none of that would've happened if you wrote it in C, like all the 
best people do.


Also, why didn't you attempt the 2nd requirement?




> #include <iostream>
> #include <thread>
> #include <sstream>
> #include <iomanip>
> 
> using namespace std;
> 
> static size_t parse( string_view str );
> 
> int main( int argc, char **argv )
> {
>      if( argc < 3 )
>          return EXIT_FAILURE;
>      size_t
>          rows = parse( argv[1] ),
>          cols = parse( argv[2] ),
>          clip = rows * cols;
>      if( argc >= 4 )
>          clip = parse( argv[3] );
>      if( (ptrdiff_t)rows < 0 || (ptrdiff_t)cols < 0 || (ptrdiff_t)clip < 
> 0 )
>          return EXIT_FAILURE;
>      unsigned width = [&]
>          {
>              ostringstream oss;
>              oss << clip;
>              return oss.str().length();
>          }();
>      for( size_t row = 0; row < rows; ++row )
>      {
>          for( size_t col = 0; col < cols; ++col )
>              if( size_t value = col * cols + row; value <= clip )
>              {
>                  cout << right << setw( width ) << col * cols + row;
>                  if( value < clip && col < cols - 1 )
>                      cout << ", ";
>              }
>              else
>                  break;
>          cout << endl;
>      }
> }
> 
> static size_t parse( string_view str )
> {
>      istringstream iss( (string( str )) );
>      size_t ret;
>      iss >> ret;
>      return iss && iss.eof() ? ret : -1;
> }

[toc] | [prev] | [next] | [standalone]


#396753

FromBonita Montero <Bonita.Montero@gmail.com>
Date2026-03-04 11:44 +0100
Message-ID<10o92e1$2r6rf$1@raubtier-asyl.eternal-september.org>
In reply to#396739
Now it fits:

#include <iostream>
#include <thread>
#include <sstream>
#include <iomanip>
#include <optional>

using namespace std;

static optional<size_t> parse( const char *str );

int main( int argc, char **argv )
{
	if( argc < 3 )
		return EXIT_FAILURE;
	optional<size_t>
		rows = parse( argv[1] ),
		cols = parse( argv[2] );
	if( !rows || !cols )
		return EXIT_FAILURE;
	size_t clip = *rows * *cols - 1;
	if( argc >= 4 )
		if( optional<size_t> pClip = parse( argv[3] ); pClip )
			clip = *pClip <= clip ? *pClip : clip;
		else
			return EXIT_FAILURE;
	unsigned width = [&]
		{
			ostringstream oss;
			oss << clip;
			return (unsigned)oss.str().length();
		}();
	if( clip < rows )
		rows = clip + 1;
	for( size_t row = 0; row < rows; ++row )
	{
		for( size_t col = 0, value; col < *cols; ++col )
			if( size_t value = col * *rows + row; value <= clip )
			{
				cout << right << setw( width ) << value;
				if( value < clip && col < *cols - 1 )
					cout << ", ";
			}
			else
				break;
		cout << endl;
	}
}

static optional<size_t> parse( const char *str )
{
	istringstream iss( str );
	size_t ret;
	iss >> ret;
	if( !iss || !iss.eof() )
		return nullopt;
	return ret;
}

The detection of parsing errors is much more comfortable with that
since the parse function returns a nullopt wenn the value could not
been parsed.
That's C++: less and more readable code.

[toc] | [prev] | [next] | [standalone]


#396769

FromDFS <nospam@dfs.com>
Date2026-03-04 17:44 -0500
Message-ID<10oacjs$3a3hc$2@dont-email.me>
In reply to#396753
On 3/4/2026 5:44 AM, Bonita Montero wrote:

<code below>


Your first code compiled fine

$ g++ rc-montero1.cpp -o rc
$


but this one tossed out a lot of errors.


$ g++ rc-montero2.cpp -o rc

rc-montero2.cpp:13:1: error: extended character   is not valid in an 
identifier
    13 |     if( argc < 3 )
       | ^
rc-montero2.cpp:13:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:13:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:13:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:15:1: error: extended character   is not valid in an 
identifier
    15 |     optional<size_t>
       | ^
rc-montero2.cpp:15:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:15:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:15:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:18:1: error: extended character   is not valid in an 
identifier
    18 |     if( !rows || !cols )
       | ^
rc-montero2.cpp:18:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:18:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:18:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:20:1: error: extended character   is not valid in an 
identifier
    20 |     size_t clip = *rows * *cols - 1;
       | ^
rc-montero2.cpp:20:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:20:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:20:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:21:1: error: extended character   is not valid in an 
identifier
    21 |     if( argc >= 4 )
       | ^
rc-montero2.cpp:21:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:21:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:21:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:26:1: error: extended character   is not valid in an 
identifier
    26 |     unsigned width = [&]
       | ^
rc-montero2.cpp:26:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:26:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:26:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:32:1: error: extended character   is not valid in an 
identifier
    32 |     if( clip < rows )
       | ^
rc-montero2.cpp:32:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:32:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:32:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:34:1: error: extended character   is not valid in an 
identifier
    34 |     for( size_t row = 0; row < rows; ++row )
       | ^
rc-montero2.cpp:34:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:34:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:34:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:35:1: error: extended character   is not valid in an 
identifier
    35 |     {
       | ^
rc-montero2.cpp:35:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:35:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:35:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:46:1: error: extended character   is not valid in an 
identifier
    46 |     }
       | ^
rc-montero2.cpp:46:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:46:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:46:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:51:1: error: extended character   is not valid in an 
identifier
    51 |     istringstream iss( str );
       | ^
rc-montero2.cpp:51:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:51:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:51:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:52:1: error: extended character   is not valid in an 
identifier
    52 |     size_t ret;
       | ^
rc-montero2.cpp:52:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:52:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:52:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:53:1: error: extended character   is not valid in an 
identifier
    53 |     iss >> ret;
       | ^
rc-montero2.cpp:53:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:53:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:53:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:54:1: error: extended character   is not valid in an 
identifier
    54 |     if( !iss || !iss.eof() )
       | ^
rc-montero2.cpp:54:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:54:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:54:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:56:1: error: extended character   is not valid in an 
identifier
    56 |     return ret;
       | ^
rc-montero2.cpp:56:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:56:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp:56:1: error: extended character   is not valid in an 
identifier
rc-montero2.cpp: In function ‘int main(int, char**)’:
rc-montero2.cpp:13:1: error: ‘    if’ was not declared in this scope
    13 |     if( argc < 3 )
       | ^~~~~~
rc-montero2.cpp:15:1: error: ‘    optional’ was not declared in this scope
    15 |     optional<size_t>
       | ^~~~~~~~~~~~
rc-montero2.cpp:15:20: error: expected primary-expression before ‘>’ token
    15 |     optional<size_t>
       |                    ^
rc-montero2.cpp:16:9: error: ‘rows’ was not declared in this scope
    16 |         rows = parse( argv[1] ),
       |         ^~~~
rc-montero2.cpp:17:9: error: ‘cols’ was not declared in this scope
    17 |         cols = parse( argv[2] );
       |         ^~~~
rc-montero2.cpp:20:1: error: ‘    size_t’ was not declared in this scope
    20 |     size_t clip = *rows * *cols - 1;
       | ^~~~~~~~~~
rc-montero2.cpp:22:56: error: ‘pClip’ was not declared in this scope
    22 |         if( optional<size_t> pClip = parse( argv[3] ); pClip )
       |                                                        ^~~~~
rc-montero2.cpp:24:9: error: ‘else’ without a previous ‘if’
    24 |         else
       |         ^~~~
rc-montero2.cpp:26:1: error: ‘    unsigned’ was not declared in this scope
    26 |     unsigned width = [&]
       | ^~~~~~~~~~~~
rc-montero2.cpp:31:11: error: expected primary-expression before ‘)’ token
    31 |         }();
       |           ^
rc-montero2.cpp:32:9: error: ‘clip’ was not declared in this scope
    32 |     if( clip < rows )
       |         ^~~~
rc-montero2.cpp:34:17: error: expected primary-expression before ‘row’
    34 |     for( size_t row = 0; row < rows; ++row )
       |                 ^~~
rc-montero2.cpp:34:26: error: ‘row’ was not declared in this scope
    34 |     for( size_t row = 0; row < rows; ++row )
       |                          ^~~
rc-montero2.cpp: In function ‘std::optional<long unsigned int> 
parse(const char*)’:
rc-montero2.cpp:51:1: error: ‘    istringstream’ was not declared in 
this scope
    51 |     istringstream iss( str );
       | ^~~~~~~~~~~~~~~~~
rc-montero2.cpp:52:1: error: ‘    size_t’ was not declared in this scope
    52 |     size_t ret;
       | ^~~~~~~~~~
rc-montero2.cpp:53:1: error: ‘    iss’ was not declared in this scope
    53 |     iss >> ret;
       | ^~~~~~~
rc-montero2.cpp:53:12: error: ‘ret’ was not declared in this scope
    53 |     iss >> ret;
       |            ^~~
rc-montero2.cpp:54:10: error: ‘iss’ was not declared in this scope
    54 |     if( !iss || !iss.eof() )
       |          ^~~
rc-montero2.cpp:54:1: error: ‘    if’ was not declared in this scope
    54 |     if( !iss || !iss.eof() )
       | ^~~~~~
rc-montero2.cpp:56:1: error: ‘    return’ was not declared in this scope
    56 |     return ret;
       | ^~~~~~~~~~
rc-montero2.cpp:57:1: warning: no return statement in function returning 
non-void [-Wreturn-type]
    57 | }
       | ^



> Now it fits:
> 
> #include <iostream>
> #include <thread>
> #include <sstream>
> #include <iomanip>
> #include <optional>
> 
> using namespace std;
> 
> static optional<size_t> parse( const char *str );
> 
> int main( int argc, char **argv )
> {
>      if( argc < 3 )
>          return EXIT_FAILURE;
>      optional<size_t>
>          rows = parse( argv[1] ),
>          cols = parse( argv[2] );
>      if( !rows || !cols )
>          return EXIT_FAILURE;
>      size_t clip = *rows * *cols - 1;
>      if( argc >= 4 )
>          if( optional<size_t> pClip = parse( argv[3] ); pClip )
>              clip = *pClip <= clip ? *pClip : clip;
>          else
>              return EXIT_FAILURE;
>      unsigned width = [&]
>          {
>              ostringstream oss;
>              oss << clip;
>              return (unsigned)oss.str().length();
>          }();
>      if( clip < rows )
>          rows = clip + 1;
>      for( size_t row = 0; row < rows; ++row )
>      {
>          for( size_t col = 0, value; col < *cols; ++col )
>              if( size_t value = col * *rows + row; value <= clip )
>              {
>                  cout << right << setw( width ) << value;
>                  if( value < clip && col < *cols - 1 )
>                      cout << ", ";
>              }
>              else
>                  break;
>          cout << endl;
>      }
> }
> 
> static optional<size_t> parse( const char *str )
> {
>      istringstream iss( str );
>      size_t ret;
>      iss >> ret;
>      if( !iss || !iss.eof() )
>          return nullopt;
>      return ret;
> }
> 
> The detection of parsing errors is much more comfortable with that
> since the parse function returns a nullopt wenn the value could not
> been parsed.
> That's C++: less and more readable code.
> 

[toc] | [prev] | [next] | [standalone]


#396770

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2026-03-04 15:13 -0800
Message-ID<87jyvrjihb.fsf@example.invalid>
In reply to#396769
DFS <nospam@dfs.com> writes:
> On 3/4/2026 5:44 AM, Bonita Montero wrote:
>
> <code below>
>
>
> Your first code compiled fine
>
> $ g++ rc-montero1.cpp -o rc
> $
>
>
> but this one tossed out a lot of errors.
>
>
> $ g++ rc-montero2.cpp -o rc
>
> rc-montero2.cpp:13:1: error: extended character   is not valid in an
> identifier
>    13 |     if( argc < 3 )
>       | ^
[277 lines deleted]

Apparently the code you compiled contained NO-BREAK-SPACE (U+00a0)
characters, and your compiler didn't tolerate them.  They have
have been in the original source (and compiled with a compiler that
accepts them), or they may have been introduced in the process of
posting the code to Usenet.  (I frankly don't care which.)

You really really didn't need to post hundreds of lines of error
messages to make that point -- especially since the code was C++
and should never have been posted to comp.lang.c in the first place.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


Page 9 of 11 — ← Prev page 1 … 7 8 [9] 10 11  Next page →

Back to top | Article view | comp.lang.c


csiph-web