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


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

Counting lines of a file

Started byjacobnavia <jacob@jacob.remcomp.fr>
First post2018-10-02 22:37 +0200
Last post2018-12-17 15:18 +0000
Articles 20 on this page of 211 — 33 participants

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


Contents

  Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-02 22:37 +0200
    Re: Counting lines of a file Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2018-10-02 16:45 -0400
      Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-03 09:51 +1300
        Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-02 22:55 +0200
          Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-02 14:31 -0700
            Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-02 23:39 +0200
              Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-02 16:39 -0700
                Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 08:49 +0200
                  Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-03 11:46 -0700
        Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-02 21:04 +0000
          Re: Counting lines of a file dave_thompson_2@comcast.net - 2018-12-14 17:52 -0500
            Re: Counting lines of a file Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-12-15 08:14 +0000
        Re: Counting lines of a file Nick Bowler <nbowler@draconx.ca> - 2018-10-02 21:24 +0000
          Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-02 23:32 +0200
            Re: Counting lines of a file queequeg@trust.no1 (Queequeg) - 2018-10-03 10:44 +0000
              Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 13:17 +0200
            Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-03 14:35 +0200
        Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-02 14:25 -0700
      Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-02 22:54 +0200
      Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-02 23:43 +0200
        Re: Counting lines of a file Andreas Perstinger <andipersti@gmail.com> - 2018-10-05 11:35 +0000
    Re: Counting lines of a file Nick Bowler <nbowler@draconx.ca> - 2018-10-02 20:56 +0000
      Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-02 23:00 +0200
        Re: Counting lines of a file Nick Bowler <nbowler@draconx.ca> - 2018-10-02 21:13 +0000
          Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-02 23:28 +0200
            Re: Counting lines of a file queequeg@trust.no1 (Queequeg) - 2018-10-03 10:48 +0000
              Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-03 12:07 +0100
                Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-03 14:49 +0200
                  Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-03 14:25 +0100
                    Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-03 16:05 +0200
                      Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-03 14:17 +0000
                      Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-03 16:53 +0100
                        Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-03 16:07 +0000
                        Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-04 15:12 +0200
                    Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-03 11:23 -0700
                      Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 20:42 +0200
                        Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-03 12:03 -0700
                          Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 21:45 +0200
                            Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-04 08:52 +1300
                            Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-03 13:26 -0700
                          Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-04 15:37 +0200
                            Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 15:06 +0100
                              Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-04 21:48 +0200
                      Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-04 15:28 +0200
                        Re: Counting lines of a file gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-04 14:16 +0000
                        Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-04 11:09 -0700
                          Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-04 22:00 +0200
                            Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 21:18 +0100
                              Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-04 20:28 +0000
                                Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 21:59 +0100
                                  Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-04 21:10 +0000
                              Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-04 15:53 -0700
                                Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-05 00:09 +0100
                                Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-05 02:06 +0100
                            Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-04 22:40 +0200
                              Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-04 21:13 +0000
                              Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 23:09 +0100
                                Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-05 07:47 +0200
                                  Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-05 09:44 +0200
                                    Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-05 12:41 +0200
                                      Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-05 16:01 +0200
                                        Re: Counting lines of a file Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-10-22 13:58 +0000
                                          Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-10-22 16:44 +0200
                                      Re: Counting lines of a file jadill33@gmail.com - 2018-10-08 09:10 -0700
                                  Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-05 13:17 +0100
                  Re: Counting lines of a file already5chosen@yahoo.com - 2018-10-03 11:34 -0700
              Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 13:14 +0200
                Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 00:59 +0100
                  Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-04 08:57 +0200
                    Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-04 20:05 +1300
                    Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 10:58 +0100
                      Re: Counting lines of a file Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-04 04:06 -0700
                        Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 15:35 +0100
                  Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 11:48 +0100
                    Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 15:30 +0100
                Re: Counting lines of a file queequeg@trust.no1 (Queequeg) - 2018-10-04 21:35 +0000
                  Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-05 07:35 +0200
            Re: Counting lines of a file Ike Naar <ike@sdf.lonestar.org> - 2018-10-06 23:56 +0000
              Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-07 09:13 +0200
                Re: Counting lines of a file Ike Naar <ike@iceland.freeshell.org> - 2018-10-11 22:14 +0000
                  Re: Counting lines of a file Ralf Damaschke <rwspam@gmx.de> - 2018-10-11 23:14 +0000
                Re: Counting lines of a file antispam@math.uni.wroc.pl - 2018-12-17 20:17 +0000
    Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-02 13:59 -0700
      Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-02 23:07 +0100
        Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-03 00:08 +0100
        Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-02 16:51 -0700
    Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 17:47 -0400
      Re: Counting lines of a file Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-10-03 11:57 +0300
        Re: Counting lines of a file James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-10-03 06:30 -0400
          Re: Counting lines of a file Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-10-03 15:37 +0300
        Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 05:20 -0700
          Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 05:33 -0700
            Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 05:55 -0700
            Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-03 22:33 +0100
              Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 17:43 -0400
                Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 02:49 +0100
                  Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 22:06 -0400
                    Re: Counting lines of a file gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-04 05:20 +0000
                  Re: Counting lines of a file already5chosen@yahoo.com - 2018-10-04 02:45 -0700
                    Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 14:42 +0100
                  Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 11:27 +0100
                    Re: Counting lines of a file already5chosen@yahoo.com - 2018-10-04 03:40 -0700
                    Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 15:17 +0100
                      Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 18:13 +0100
                        Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-04 17:47 +0000
                          Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 20:49 +0100
                          Re: Counting lines of a file nobody@example.org (Scott) - 2018-10-05 16:52 +0000
                        Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-05 01:49 +0100
                          Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-05 12:08 +0100
                            Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 03:24 +0100
                              Re: Counting lines of a file Spiros Bousbouras <spibou@gmail.com> - 2018-10-06 03:47 +0000
                                Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 14:41 +0100
                                  Re: Counting lines of a file Spiros Bousbouras <spibou@gmail.com> - 2018-10-06 15:05 +0000
                                    Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 20:08 +0100
                              Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-06 13:02 +0100
                                Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 15:51 +0100
                                  Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-06 17:15 +0100
                                    Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-06 13:22 -0700
                                      Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-06 22:27 +0100
                                        Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-07 11:55 +1300
                                          Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-07 00:02 +0100
                                            Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-07 12:10 +1300
                                              Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-07 01:33 +0100
                                        Re: Counting lines of a file mark.bluemel@gmail.com - 2018-10-08 01:33 -0700
                                          Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-08 12:20 +0100
                                    Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 21:51 +0100
                                  Re: Counting lines of a file already5chosen@yahoo.com - 2018-10-06 12:52 -0700
                                    Re: Counting lines of a file already5chosen@yahoo.com - 2018-10-06 13:01 -0700
                                      Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 22:01 +0100
                                Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-06 13:17 -0700
                              Re: Counting lines of a file antispam@math.uni.wroc.pl - 2018-12-17 20:50 +0000
                          Re: Counting lines of a file Anton Shepelev <anton.txt@gmail.com> - 2018-10-05 23:09 +0300
                            Re: Counting lines of a file Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-06 04:02 -0700
                              Re: Counting lines of a file Anton Shepelev <anton.txt@gmail.com> - 2018-10-07 00:29 +0300
                Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-04 13:22 +0000
                  Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-04 08:00 -0700
                    Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-10-04 15:30 +0000
                      Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-04 08:34 -0700
                    Re: Counting lines of a file Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-04 09:27 -0700
                      Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-04 11:04 -0700
              Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-03 22:50 +0100
                Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-04 11:30 +1300
                Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-03 15:41 -0700
                  Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 00:46 +0100
                    Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-04 13:01 +1300
                      Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-04 01:22 +0100
                        Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-04 13:39 +1300
                    Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-03 18:23 -0700
          Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-03 13:33 +0100
            Re: Counting lines of a file Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-10-03 15:40 +0300
            Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 05:57 -0700
              Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-03 22:19 +0100
    Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-03 11:25 +1300
      Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 18:56 -0400
        Re: Counting lines of a file Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-10-03 12:11 +0300
          Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-03 23:06 +1300
            Re: Counting lines of a file Anton Shepelev <ant0n.txt@gmai1.c0m> - 2018-10-03 14:58 +0300
              Re: Counting lines of a file Ian Collins <ian-news@hotmail.com> - 2018-10-04 08:08 +1300
          Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 05:06 -0700
            Re: Counting lines of a file Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-10-03 15:13 +0300
              Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 05:26 -0700
    Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-03 02:59 +0100
      Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 08:57 +0200
      Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 08:59 +0200
        Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-03 21:54 +0100
          Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 23:26 +0200
            Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-03 22:41 +0100
            Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 02:23 +0100
          Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-03 14:59 -0700
            Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 03:04 +0100
      Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 09:01 +0200
        Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-03 22:01 +0100
    Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-03 21:44 +0200
      Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 15:48 -0400
    Re: Counting lines of a file Anton Shepelev <anton.txt@gmail.com> - 2018-10-03 23:15 +0300
      Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-10-03 13:35 -0700
        Re: Counting lines of a file Anton Shepelev <anton.txt@gmail.com> - 2018-10-04 00:14 +0300
          Re: Counting lines of a file Bart <bc@freeuk.com> - 2018-10-03 23:15 +0100
            Re: Counting lines of a file Anton Shepelev <anton.txt@gmail.com> - 2018-10-04 23:28 +0300
          Re: Counting lines of a file James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-10-03 19:39 -0400
            Re: Counting lines of a file Nick Bowler <nbowler@draconx.ca> - 2018-10-04 15:31 +0000
      Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 01:05 +0100
    Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-04 14:04 +0200
      Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 15:48 +0100
    Re: Counting lines of a file jacobnavia <jacob@jacob.remcomp.fr> - 2018-10-05 18:29 +0200
    Re: Counting lines of a file Joey Pabalinas <joeypabalinas@gmail.com> - 2018-12-16 07:50 -1000
      Re: Counting lines of a file Joey Pabalinas <joeypabalinas@gmail.com> - 2018-12-16 07:54 -1000
      Re: Counting lines of a file rbowman <bowman@montana.com> - 2018-12-16 12:51 -0700
        Re: Counting lines of a file Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-12-16 20:51 +0000
          Re: Counting lines of a file rbowman <bowman@montana.com> - 2018-12-16 14:40 -0700
            Re: Counting lines of a file Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-12-16 21:50 +0000
              Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-12-16 15:38 -0800
              Re: Counting lines of a file rbowman <bowman@montana.com> - 2018-12-16 20:29 -0700
                Re: Counting lines of a file Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-12-18 21:03 +0000
        Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-16 21:17 +0000
        Re: Counting lines of a file Joey Pabalinas <joeypabalinas@gmail.com> - 2018-12-16 17:13 -1000
          Re: Counting lines of a file rbowman <bowman@montana.com> - 2018-12-16 23:11 -0700
            Re: Counting lines of a file Joey Pabalinas <joeypabalinas@gmail.com> - 2018-12-16 22:05 -1000
            Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-12-17 11:52 -0800
              Re: Counting lines of a file luser droog <luser.droog@gmail.com> - 2018-12-17 16:01 -0800
                Re: Counting lines of a file Keith Thompson <kst-u@mib.org> - 2018-12-17 17:35 -0800
                  Re: Counting lines of a file fir <profesor.fir@gmail.com> - 2018-12-19 15:54 -0800
                Re: Counting lines of a file rbowman <bowman@montana.com> - 2018-12-17 20:01 -0700
                Re: Counting lines of a file Ike Naar <ike@iceland.freeshell.org> - 2018-12-18 07:44 +0000
                  Re: Counting lines of a file nobody@example.org (Scott) - 2018-12-18 09:29 +0000
                    Re: Counting lines of a file David Brown <david.brown@hesbynett.no> - 2018-12-18 13:18 +0100
                Re: Counting lines of a file James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-18 06:10 -0800
                  Re: Counting lines of a file rbowman <bowman@montana.com> - 2018-12-18 08:12 -0700
              Re: Counting lines of a file "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-19 07:47 -0800
      Re: Counting lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-16 20:41 +0000
      Re: Counting lines of a file scott@slp53.sl.home (Scott Lurndal) - 2018-12-17 15:18 +0000

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


#136199

FromNick Bowler <nbowler@draconx.ca>
Date2018-10-04 15:31 +0000
Message-ID<pp5bpd$9kl$1@dont-email.me>
In reply to#136152
On Wed, 03 Oct 2018 19:39:18 -0400, James Kuyper wrote:
> stdin, stdout, and stderr are opened for you prior to the start of
> your program in text mode. (7.21.3p7). They can be changed to binary
> mode using freopen(), which is presumably what those utilities do.

Unfortunately, freopen is not actually a portable way to do this.  In
C89 there was no defined way to do it and C99 leaves the mode changes
squarely in implementation-defined territory.

My experience is that freopen simply does not work to change text to
binary modes on the very platforms where this would be a useful thing
to do.

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


#136156

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2018-10-04 01:05 +0100
Message-ID<87ftxmshio.fsf@bsb.me.uk>
In reply to#136132
Anton Shepelev <anton.txt@gmail.com> writes:

> TCC's implementations of getc and fgetc seem to collapse
> \r\n into \n, and its fputc to expand \n in \r\n.  Does
> anybody else observe this behavior with TCC (Bart?)?
> fputc("\n", file) writes two bytes.  Is it normal?

For text files, yes, provided the system uses \r\n as the line
terminator.  In fact, it's mandated by the standard.

On Unix-like systems, and with streams opened in binary mode on any
system, \r\n should be read as two characters.

-- 
Ben.

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


#136178

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2018-10-04 14:04 +0200
Message-ID<pp4vk0$ri2$1@dont-email.me>
In reply to#136032
Many people here complained that my little program did not handle files 
with embedded newlines correctly. They complained that "UNIX is 
different" blah blah blah...

I forgot to tell them that this program conforms to POSIX.1-2008 that 
forbids newlines and weird characters in file names.

<quote>
For a filename to be portable across implementations conforming to 
POSIX.1-2008, it shall consist only of the portable filename character 
set as defined in Portable Filename Character Set. Portable filenames 
shall not have the <hyphen> character as the first character since this 
may cause problems when filenames are passed as command line arguments.
<end quote>

The "Portable Filename Character Set", defined in 3.276 (“Portable 
Filename Character Set”); this turns out to be just A-Z, a-z, 0-9, 
<period>, <underscore>, and <hyphen> (aka the dash character).

People arguing against this program are just that: people that promote 
non portable constructs.

PERIOD!

Yours sincerely

jacob :-)

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


#136195

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2018-10-04 15:48 +0100
Message-ID<87efd5py34.fsf@bsb.me.uk>
In reply to#136178
jacobnavia <jacob@jacob.remcomp.fr> writes:

> Many people here complained that my little program did not handle
> files with embedded newlines correctly. They complained that "UNIX is
> different" blah blah blah...
>
> I forgot to tell them that this program conforms to POSIX.1-2008 that
> forbids newlines and weird characters in file names.

POSIX does not forbid "weird characters" in file names.  It defines a
maximally portable filename character set, which is, as you point out,
very limited indeed.  No one would say that "POSIX forbids commas in
file names" despite comma not being one of the maximally portable
filename characters.

But it's fine (as far as I am concerned) that your proposed lc program
does not handle newlines in filenames in the input.  (It handles them on
the command line.)

-- 
Ben.

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


#136289

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2018-10-05 18:29 +0200
Message-ID<pp83hg$1kn$1@dont-email.me>
In reply to#136032
Le 05/10/2018 à 16:31, Stefan Ram a écrit :
> jacobnavia <jacob@jacob.remcomp.fr> writes:
>> So, I decided to rewrite "wc" as "lc" (for Line Count")
> 
>    Here is a quotation from
> 
> From: ram@zedat.fu-berlin.de (Stefan Ram)
> Organization: Stefan Ram
> Message-ID: <zaehlen-20060128050533@ram.dialup.fu-berlin.de>
> Newsgroups: de.comp.lang.c
> 
>    which shows a C program to count '\n' in a file I wrote in
>    2006. The counter variable apparently is so large (1024
>    decimal digits) that it can never possibly overflow! I did
>    not check this program today to see whether it works.
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <assert.h>
> /*
> 
> 1  functions for counting
> 
> 1.1  The reset function
> 
> Synopsis
> 
> void reset( char * a, int size );
> 
> Description
> 
> The reset function resets the number represented
> by "a" and with size "size" to zero.
> 
> */
> void reset ( char * const a, int const size )
> { for( int i = 0; i < size; ++i )a[ i ]= 0; }
> 
> static void incat( char * const a, int const size, int const pos )
> { assert( pos < size - 2 );
>    char * const at = a + size - 2 - pos;
>    if( !*at )*at = '0'; if( *at < '9' )++*at;
>    else *at = '0', incat( a, size, pos + 1 ); }
> /*
> 
> 1.2  The inc function
> 
> Synopsis
> 
> void inc( char * a, int size, int pos );
> 
> Description
> 
> The inc function increments the number represented
> by "a" and with size "size". The behaviour of this
> function and all other functions for counting will
> become undefined if the counter overflows.
> 
> */
> void inc( char * const a, int const size )
> { incat( a, size, 0 ); }
> /*
> 
> 1.3  The text function
> 
> Synopsis
> 
> void text( char * a );
> 
> Description
> 
> The text function returns a pointer to  a text
> representation of the counter "a".
> 
> Returns
> 
> A text representation of the counter "a". The
> data pointed to should be considered as read only.
> 
> */
> char * text( char * a ){ while( !*a )++a; return a; }
> /*
> 
> 2  functions for counting the numbers of lines in a file
> 
> 2.1  The filelines function
> 
> Synopsis
> 
> char * filelines
> ( FILE * file, char * a, int size )
> 
> Description
> 
> The filelines function returns the number of newline characters
> found in the file "file", which is assumed to be opened but not
> yet read from.  The client must make sure that "a" points to
> writeable memory of size "size", which must be so large as to
> contain a decimal numeral of the largest possibly file size plus
> an additional terminating NUL character.
> 
> Returns
> 
> The address of a C string with a decimal numeral representing the
> file size or 0 to represent a read error.
> */
> char * filelines
> ( FILE * const file,
>    char * const a, int const size )
> { assert( size > 2 ); reset( a, size );
>    for( int looping = 1; looping; )
>    { int const c = getc( file );
>      looping = c != EOF;
>      if( c == '\n' )inc( a, size ); }
>    return ferror( file )? 0 : text( a ); }
> /*
> 
> 2  functions for counting the numbers of lines in a file
> 
> 2.1  The pathlines function
> 
> Synopsis
> 
> char * pathlines
> ( const char * path, char * a, int size )
> 
> Description
> 
> The pathlines function is like the filelines function,
> but its first argument is file path.
> 
> Returns
> 
> (See the filelines function.)
> 
> */
> char * pathlines
> ( const char * const path,
>    char * const a, int const size )
> { char * result = 0;
>    for( FILE * file = fopen( path, "r" ); file; )
>    { result = filelines( file, a, size );
>      if( fclose( file ))result = 0;
>      file = 0; }
>    return result; }
> 
> #define SIZE 1024
> int main( int const argc, char const * const * const argv )
> { int result = EXIT_FAILURE; char a[ SIZE ];
>    if( argc == 2 )
>    { char * const product = pathlines( 1[ argv ], a, SIZE );
>      if( product )
>      { if( 0 < printf( "%.*s\n", SIZE - 1, product ))
>        result = EXIT_SUCCESS; }
>      else fprintf( stderr, "read error.\n" ); }
>    else fprintf( stderr, "Usage: %s file\n", argv[ 0 ]);
>    return result; }
> 
> 
> 
> 
> 

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


#138696

FromJoey Pabalinas <joeypabalinas@gmail.com>
Date2018-12-16 07:50 -1000
Message-ID<20181216175017.osnsg7xnwhlvjvkk@gmail.com>
In reply to#136032

[Multipart message — attachments visible in raw view] — view raw

On Tue, Oct 02, 2018 at 10:37:15PM +0200, jacobnavia wrote:
> Unix has the "wc" utility to count the lines of a file. It is a pity that
> under linux that program is unusable to count lines in a hierarchy of
> several directories. It requires ZERO terminated file names, and the "find"
> utility produces \n terminated file names, so it is unusable for that.
> 
> So, I decided to rewrite "wc" as "lc" (for Line Count")
> 
> It took me a few hours, and I wanted to post the result here, since it is
> (maybe) a useful program, and the way I wrote it explain some opinions I
> have about software design.
> 
> Here it is:
> -----------------------------------------------cut here

A fun exercise is also trying to handle "-" arguments in _any_ argument
position:

	#include <stdio.h>
	#include <stdlib.h>
	#include <string.h>
	#include <unistd.h>

	int tok(size_t *cnt, FILE * f, int last)
	{
		int ret;
		if (!cnt || !f)
			return EOF;
		ret = getc(f);
		if (ret == '\n' || (ret == EOF && last != '\n'))
			++*cnt;
		return ret;
	}

	void walk(size_t *lines, FILE *f) {
		for (int last = 0, c = tok(lines, f, last); c != EOF; last = c, c = tok(lines, f, last));
	}

	int main(int argc, char **argv)
	{
		char *name = "stdin";
		FILE *f = stdin;

		/* special case no arguments */
		if (argc < 2) {
			size_t lines = 0;
			/* walk the file */
			walk(&lines, f);
			printf("%zu %s\n", lines, name);
			/* exit early */
			return 0;
		}

		/* skip "-" */
		if (argv[1] && strcmp(argv[1], "-")) {
			f = fopen(argv[1], "r");
		}

		/* walk each file */
		for (int i = 1; i < argc && f; i++) {
			size_t lines = 0;

			name = argv[i] ? argv[i] : "stdin";

			/* handle "-" arguuments */
			if (!argv[i] || !strcmp(name, "-")) {
				f = stdin;
				name = "stdin";
			/* else strip directory components */
			} else {
				name = strrchr(name, '/');
				name = name ?  name + 1 : argv[i];
				f = fopen(argv[i], "r");
			}

			/* calculate and print count */
			walk(&lines, f);
			printf("%zu %s\n", lines, name);

			/* cleanup */
			if (f != stdin)
				fclose(f);
		}

		return 0;
	}

This just counts the number of '\n' and handles the one edge case where
the file isn't terminated by a newline. As you can see, handling "-"
arguments can be surprisingly complicated.

-- 
Cheers,
Joey Pabalinas

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


#138697

FromJoey Pabalinas <joeypabalinas@gmail.com>
Date2018-12-16 07:54 -1000
Message-ID<20181216175406.z46m3ab6vld6qn2x@gmail.com>
In reply to#138696

[Multipart message — attachments visible in raw view] — view raw

On Sun, Dec 16, 2018 at 07:50:17AM -1000, Joey Pabalinas wrote:
> 	#include <unistd.h>

Ignore the useless #include directive :)

-- 
Cheers,
Joey Pabalinas

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


#138699

Fromrbowman <bowman@montana.com>
Date2018-12-16 12:51 -0700
Message-ID<g7noj9Fo6neU1@mid.individual.net>
In reply to#138696
On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
> This just counts the number of '\n' and handles the one edge case where
> the file isn't terminated by a newline. As you can see, handling "-"
> arguments can be surprisingly complicated.

It becomes easier if you use getopt(). See the man page for an example.

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


#138701

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2018-12-16 20:51 +0000
Message-ID<slrnq1deln.1p1h.grahn+nntp@frailea.sa.invalid>
In reply to#138699
On Sun, 2018-12-16, rbowman wrote:
> On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
>> This just counts the number of '\n' and handles the one edge case where
>> the file isn't terminated by a newline. As you can see, handling "-"
>> arguments can be surprisingly complicated.
>
> It becomes easier if you use getopt(). See the man page for an example.

I was going to say "getopt is Unix-specific", but I see he already
includes <unistd.h>.  You're right. There are no good reasons
whatsoever not to use getopt() or getopt_long() in that case.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

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


#138703

Fromrbowman <bowman@montana.com>
Date2018-12-16 14:40 -0700
Message-ID<g7nv0cFpivsU1@mid.individual.net>
In reply to#138701
On 12/16/2018 01:51 PM, Jorgen Grahn wrote:
> On Sun, 2018-12-16, rbowman wrote:
>> On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
>>> This just counts the number of '\n' and handles the one edge case where
>>> the file isn't terminated by a newline. As you can see, handling "-"
>>> arguments can be surprisingly complicated.
>>
>> It becomes easier if you use getopt(). See the man page for an example.
>
> I was going to say "getopt is Unix-specific", but I see he already
> includes <unistd.h>.  You're right. There are no good reasons
> whatsoever not to use getopt() or getopt_long() in that case.
>
> /Jorgen
>

Then the OP corrected himself and said the <unistd.h> wasn't necessary 
:) There are several ports on CodeProject or Github for C, C++, and C#. 
Of all the POSIX functions that's one that is really missed. We have a 
lot of legacy code and whether it's  "-pfoo" or "-p foo" depends on who 
wrote it.

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


#138705

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2018-12-16 21:50 +0000
Message-ID<slrnq1di5i.1p1h.grahn+nntp@frailea.sa.invalid>
In reply to#138703
On Sun, 2018-12-16, rbowman wrote:
> On 12/16/2018 01:51 PM, Jorgen Grahn wrote:
>> On Sun, 2018-12-16, rbowman wrote:
>>> On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
>>>> This just counts the number of '\n' and handles the one edge case where
>>>> the file isn't terminated by a newline. As you can see, handling "-"
>>>> arguments can be surprisingly complicated.
>>>
>>> It becomes easier if you use getopt(). See the man page for an example.
>>
>> I was going to say "getopt is Unix-specific", but I see he already
>> includes <unistd.h>.  You're right. There are no good reasons
>> whatsoever not to use getopt() or getopt_long() in that case.
>
> Then the OP corrected himself and said the <unistd.h> wasn't necessary 
> :)

Ah, ok.

> There are several ports on CodeProject or Github for C, C++, and C#. 
> Of all the POSIX functions that's one that is really missed. We have a 
> lot of legacy code and whether it's  "-pfoo" or "-p foo" depends on who 
> wrote it.

I think I'm missing some context, but normally in Unix, those two are
synonyms.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

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


#138706

FromKeith Thompson <kst-u@mib.org>
Date2018-12-16 15:38 -0800
Message-ID<lnftuxf3fg.fsf@kst-u.example.com>
In reply to#138705
Jorgen Grahn <grahn+nntp@snipabacken.se> writes:
> On Sun, 2018-12-16, rbowman wrote:
[...]
>> There are several ports on CodeProject or Github for C, C++, and C#. 
>> Of all the POSIX functions that's one that is really missed. We have a 
>> lot of legacy code and whether it's  "-pfoo" or "-p foo" depends on who 
>> wrote it.
>
> I think I'm missing some context, but normally in Unix, those two are
> synonyms.

It depends.  "-pfoo" can be equivalent either to "-p foo" or to
"-p -f -o -o", depending on how the 'p' option was defined in the
optstring argument passed to the getopt() function.

-- 
Keith Thompson (The_Other_Keith) kst@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


#138709

Fromrbowman <bowman@montana.com>
Date2018-12-16 20:29 -0700
Message-ID<g7ojekFtm8pU1@mid.individual.net>
In reply to#138705
On 12/16/2018 02:50 PM, Jorgen Grahn wrote:
> On Sun, 2018-12-16, rbowman wrote:
>> On 12/16/2018 01:51 PM, Jorgen Grahn wrote:
>>> On Sun, 2018-12-16, rbowman wrote:
>>>> On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
>>>>> This just counts the number of '\n' and handles the one edge case where
>>>>> the file isn't terminated by a newline. As you can see, handling "-"
>>>>> arguments can be surprisingly complicated.
>>>>
>>>> It becomes easier if you use getopt(). See the man page for an example.
>>>
>>> I was going to say "getopt is Unix-specific", but I see he already
>>> includes <unistd.h>.  You're right. There are no good reasons
>>> whatsoever not to use getopt() or getopt_long() in that case.
>>
>> Then the OP corrected himself and said the <unistd.h> wasn't necessary
>> :)
>
> Ah, ok.
>
>> There are several ports on CodeProject or Github for C, C++, and C#.
>> Of all the POSIX functions that's one that is really missed. We have a
>> lot of legacy code and whether it's  "-pfoo" or "-p foo" depends on who
>> wrote it.
>
> I think I'm missing some context, but normally in Unix, those two are
> synonyms.

They should be but we have a codebase that's about 25 years old and 
written by programmers of varying skill levels. One common pattern was 
to look for '-' in argv[i][0], switch of argv[i][1], and then do a 
strcpy, atof, or whatever else you were expecting on argv[i][2] rather 
than using argv[i+1] as the parameter after the flag.

Poor programming to be sure but that's legacy code for you. getopt() 
standardizes the process without everyone rolling their own command line 
parser.






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


#138739

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2018-12-18 21:03 +0000
Message-ID<slrnq1io4n.1p1h.grahn+nntp@frailea.sa.invalid>
In reply to#138709
On Mon, 2018-12-17, rbowman wrote:
> On 12/16/2018 02:50 PM, Jorgen Grahn wrote:
>> On Sun, 2018-12-16, rbowman wrote:
>>> On 12/16/2018 01:51 PM, Jorgen Grahn wrote:
>>>> On Sun, 2018-12-16, rbowman wrote:
>>>>> On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
>>>>>> This just counts the number of '\n' and handles the one edge case where
>>>>>> the file isn't terminated by a newline. As you can see, handling "-"
>>>>>> arguments can be surprisingly complicated.
>>>>>
>>>>> It becomes easier if you use getopt(). See the man page for an example.
>>>>
>>>> I was going to say "getopt is Unix-specific", but I see he already
>>>> includes <unistd.h>.  You're right. There are no good reasons
>>>> whatsoever not to use getopt() or getopt_long() in that case.
>>>
>>> Then the OP corrected himself and said the <unistd.h> wasn't necessary
>>> :)
>>
>> Ah, ok.
>>
>>> There are several ports on CodeProject or Github for C, C++, and C#.
>>> Of all the POSIX functions that's one that is really missed. We have a
>>> lot of legacy code and whether it's  "-pfoo" or "-p foo" depends on who
>>> wrote it.
>>
>> I think I'm missing some context, but normally in Unix, those two are
>> synonyms.
>
> They should be but we have a codebase that's about 25 years old and 
> written by programmers of varying skill levels. One common pattern was 
> to look for '-' in argv[i][0], switch of argv[i][1], and then do a 
> strcpy, atof, or whatever else you were expecting on argv[i][2] rather 
> than using argv[i+1] as the parameter after the flag.
>
> Poor programming to be sure but that's legacy code for you. getopt() 
> standardizes the process without everyone rolling their own command line 
> parser.

Ok, I see.  Fair enough, for ancient code which cannot be touched, but
I wouldn't tolerate it in new Unix code today.  (Which is where this
thread started).

It's really annoying for me as a user too, when the arguments don't
behave in the expected, predictable way.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

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


#138702

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2018-12-16 21:17 +0000
Message-ID<87zht5rx1n.fsf@bsb.me.uk>
In reply to#138699
rbowman <bowman@montana.com> writes:

> On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
>> This just counts the number of '\n' and handles the one edge case where
>> the file isn't terminated by a newline. As you can see, handling "-"
>> arguments can be surprisingly complicated.
>
> It becomes easier if you use getopt().

Does it?  The program process no options so I don't see how things get
simpler using getopt.  Am I missing something getopt can help with here?

-- 
Ben.

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


#138708

FromJoey Pabalinas <joeypabalinas@gmail.com>
Date2018-12-16 17:13 -1000
Message-ID<20181217031316.qy4qq6bfwkptw2gw@gmail.com>
In reply to#138699

[Multipart message — attachments visible in raw view] — view raw

On Sun, Dec 16, 2018 at 12:51:19PM -0700, rbowman wrote:
> On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
> > This just counts the number of '\n' and handles the one edge case where
> > the file isn't terminated by a newline. As you can see, handling "-"
> > arguments can be surprisingly complicated.
> 
> It becomes easier if you use getopt(). See the man page for an example.

Come on now, doing things the simple and sane way is no fun!

-- 
Cheers,
Joey Pabalinas

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


#138711

Fromrbowman <bowman@montana.com>
Date2018-12-16 23:11 -0700
Message-ID<g7ostiF112gU1@mid.individual.net>
In reply to#138708
On 12/16/2018 08:13 PM, Joey Pabalinas wrote:
> On Sun, Dec 16, 2018 at 12:51:19PM -0700, rbowman wrote:
>> On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
>>> This just counts the number of '\n' and handles the one edge case where
>>> the file isn't terminated by a newline. As you can see, handling "-"
>>> arguments can be surprisingly complicated.
>>
>> It becomes easier if you use getopt(). See the man page for an example.
>
> Come on now, doing things the simple and sane way is no fun!
>

Ever here of technical debt? That's when the weird and wacky code of 
past programmers catches up to you. We had one very smart programmer who 
did every perverted thing you can imagine with macros. Then he died and 
left the steaming mess. I can't remember if it was Kernighan or Ritchie 
who said if they knew what people would do with macros they would have 
left them out of the language.

I also forget who said if you use every ounce of your creativity writing 
the code you're going to be up the creek when you try to debug it.

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


#138712

FromJoey Pabalinas <joeypabalinas@gmail.com>
Date2018-12-16 22:05 -1000
Message-ID<20181217080535.inb5ap45ddstdc5v@gmail.com>
In reply to#138711

[Multipart message — attachments visible in raw view] — view raw

On Sun, Dec 16, 2018 at 11:11:12PM -0700, rbowman wrote:
> On 12/16/2018 08:13 PM, Joey Pabalinas wrote:
> > On Sun, Dec 16, 2018 at 12:51:19PM -0700, rbowman wrote:
> > > On 12/16/2018 10:50 AM, Joey Pabalinas wrote:
> > > > This just counts the number of '\n' and handles the one edge case where
> > > > the file isn't terminated by a newline. As you can see, handling "-"
> > > > arguments can be surprisingly complicated.
> > > 
> > > It becomes easier if you use getopt(). See the man page for an example.
> > 
> > Come on now, doing things the simple and sane way is no fun!
> > 
> 
> Ever here of technical debt? That's when the weird and wacky code of past
> programmers catches up to you. We had one very smart programmer who did
> every perverted thing you can imagine with macros. Then he died and left the
> steaming mess. I can't remember if it was Kernighan or Ritchie who said if
> they knew what people would do with macros they would have left them out of
> the language.
> 
> I also forget who said if you use every ounce of your creativity writing the
> code you're going to be up the creek when you try to debug it.

For the record, I'd never suggest hand-rolling a getopts()
implementation in anything even remotely serious. It's just
too much effort for so little gain. However, trying it once
to feel around and see how all the parts work can be a useful
exercise.

It's like how hand-rolling an LR(1) parser yourself is a huge
waste of time, but writing your first one will help you grok
the bottom-up parser states machines in ways that reading
theory and reasoning in your head just never could.

Plus, you'll often encounter the occasional problem you thought you
understood well, but in reality turns out you were dead wrong. I
consider these incredibly valuable, and if you fine with humbling
yourself on occasion you will learn a lot from them.

Aside from the above, I 100% agree with everything you've said. I
try my best to keep my cognitive load as possible both, both so
I have energy and motivation to expend on really tough problems
and so that so the poor guys who come after me don't have to spend
a week trying to decipher a single function.

-- 
Cheers,
Joey Pabalinas

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


#138715

FromKeith Thompson <kst-u@mib.org>
Date2018-12-17 11:52 -0800
Message-ID<lnbm5kexs6.fsf@kst-u.example.com>
In reply to#138711
rbowman <bowman@montana.com> writes:
[...]
> I also forget who said if you use every ounce of your creativity writing 
> the code you're going to be up the creek when you try to debug it.

That was Brian Kernighan (the K of K&R):

"Everyone knows that debugging is twice as hard as writing a program in
the first place. So if you're as clever as you can be when you write it,
how will you ever debug it?"

-- 
Keith Thompson (The_Other_Keith) kst@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


#138722

Fromluser droog <luser.droog@gmail.com>
Date2018-12-17 16:01 -0800
Message-ID<c8ac7810-280e-446c-9fda-eff8520bd011@googlegroups.com>
In reply to#138715
On Monday, December 17, 2018 at 1:52:33 PM UTC-6, Keith Thompson wrote:
> rbowman <bowman@montana.com> writes:
> [...]
> > I also forget who said if you use every ounce of your creativity writing 
> > the code you're going to be up the creek when you try to debug it.
> 
> That was Brian Kernighan (the K of K&R):
> 
> "Everyone knows that debugging is twice as hard as writing a program in
> the first place. So if you're as clever as you can be when you write it,
> how will you ever debug it?"
> 

I have been pondering this quote for some time now, and I think I have
an answer to it: "Get smarter!" Easier said than done, of course. But
cleverness is not (necessarily) a vice.

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


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

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


csiph-web