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


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

>< swap operator

Started byskybuck2000@hotmail.com
First post2018-08-13 12:53 -0700
Last post2018-10-10 18:24 -0700
Articles 20 on this page of 354 — 27 participants

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


Contents

  >< swap operator skybuck2000@hotmail.com - 2018-08-13 12:53 -0700
    Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-08-13 16:05 -0400
    Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-13 13:46 -0700
      Re: >< swap operator Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-08-14 11:19 +0300
      Re: >< swap operator skybuck2000@hotmail.com - 2018-08-14 06:16 -0700
        Re: >< swap operator bart4858@gmail.com - 2018-08-14 07:50 -0700
          Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-08-14 16:59 +0200
            Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-08-14 10:46 -0700
              Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-08-14 20:03 +0200
                Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-08-14 11:37 -0700
                  Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-08-14 21:16 +0200
            Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-14 11:32 -0700
            Re: >< swap operator bart4858@gmail.com - 2018-08-14 16:24 -0700
              Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-08-15 11:32 +0200
          Re: >< swap operator skybuck2000@hotmail.com - 2018-10-01 07:46 -0700
            Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 05:20 -0700
              Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 13:58 +0100
                Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 14:08 +0100
                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 09:16 -0400
                    Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-02 15:35 +0200
                      Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 09:43 -0400
                  Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-02 10:51 -0700
                Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 09:08 -0400
                  Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 15:26 +0100
                    Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 10:52 -0400
                      Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 17:57 +0100
                        Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 13:27 -0400
                          Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 11:52 -0700
                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 20:48 +0100
                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 15:56 -0400
                              Re: >< swap operator Thiago Adams <thiago.adams@gmail.com> - 2018-10-02 13:05 -0700
                                Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-02 13:26 -0700
                                  Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 21:36 +0100
                                    Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-02 13:47 -0700
                                    Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-03 11:14 +0200
                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 16:37 -0400
                                    Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 22:02 +0100
                                      Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 17:16 -0400
                                        Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-03 11:25 +0200
                                          Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-03 10:52 +0100
                                            Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-03 14:29 +0200
                                              Re: >< swap operator Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-03 05:52 -0700
                                                Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-03 21:31 +0100
                                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 16:47 -0400
                                                    Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 03:43 +0100
                                                      Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 22:47 -0400
                                                        Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 04:25 +0100
                                                          Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 20:44 -0700
                                                            Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 11:53 +0100
                                                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-04 05:15 -0700
                                                                Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-04 13:48 +0100
                                                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-04 10:56 -0400
                                                                Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 17:47 +0100
                                                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-04 11:01 -0700
                                                                    Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-04 22:15 +0200
                                                                      Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-04 16:19 -0400
                                                                        Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-04 21:42 +0100
                                                                          Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-04 15:01 -0700
                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-04 23:59 +0100
                                                                              Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-05 09:54 +0200
                                                                                Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-05 18:03 +0100
                                                                                  Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-05 21:08 +0200
                                                                                  Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-05 20:31 +0100
                                                                                    Re: >< swap operator Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2018-10-05 15:59 -0400
                                                                                    Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-05 21:18 +0100
                                                                                      Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 03:51 +0100
                                                                                        Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-06 12:19 +0100
                                                                                          Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 19:49 +0100
                                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-07 12:25 +0100
                                                                                              Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-07 14:19 +0100
                                                                                                Re: >< swap operator Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-07 06:56 -0700
                                                                                                  Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-07 16:30 +0100
                                                                                                  Re: >< swap operator Wouter Verhelst <w@uter.be> - 2018-10-09 13:17 +0200
                                                                                                    C idioms (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-09 13:07 +0000
                                                                                                      Re: C idioms (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-09 14:27 +0100
                                                                                                        Re: C idioms Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-10 00:05 +0100
                                                                                                          Re: C idioms Bart <bc@freeuk.com> - 2018-10-10 02:03 +0100
                                                                                                            Re: C idioms Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-11 01:05 +0100
                                                                                                              Re: C idioms Bart <bc@freeuk.com> - 2018-10-11 02:09 +0100
                                                                                                                Re: C idioms Bart <bc@freeuk.com> - 2018-10-11 12:39 +0100
                                                                                                                  Re: C idioms Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-11 16:24 +0100
                                                                                                                    Re: C idioms scott@slp53.sl.home (Scott Lurndal) - 2018-10-11 15:55 +0000
                                                                                                                      Re: C idioms Keith Thompson <kst-u@mib.org> - 2018-10-11 09:42 -0700
                                                                                                                        Re: C idioms Wouter Verhelst <w@uter.be> - 2018-10-11 19:23 +0200
                                                                                                                          Re: C idioms jameskuyper@alumni.caltech.edu - 2018-10-11 11:11 -0700
                                                                                                                          Re: C idioms Keith Thompson <kst-u@mib.org> - 2018-10-11 12:05 -0700
                                                                                                                      Re: C idioms Bart <bc@freeuk.com> - 2018-10-11 17:53 +0100
                                                                                                                      Re: C idioms Keith Thompson <kst-u@mib.org> - 2018-10-11 10:38 -0700
                                                                                                                      Re: C idioms Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-12 00:14 +0100
                                                                                                                    Re: C idioms Bart <bc@freeuk.com> - 2018-10-11 19:26 +0100
                                                                                                      Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-09 16:38 +0200
                                                                                                        Re: C idioms (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-09 15:23 +0000
                                                                                                          Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-09 20:31 +0200
                                                                                                            Re: C idioms (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-09 20:18 +0100
                                                                                                              Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-09 22:11 +0200
                                                                                                            Re: C idioms (Was: >< swap operator) scott@slp53.sl.home (Scott Lurndal) - 2018-10-09 20:50 +0000
                                                                                                              Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-09 22:58 +0200
                                                                                                                Re: C idioms (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-09 22:34 +0100
                                                                                                                  Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-10 08:10 +0200
                                                                                                                Re: C idioms (Was: >< swap operator) jameskuyper@alumni.caltech.edu - 2018-10-09 14:45 -0700
                                                                                                                  Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-10 08:07 +0200
                                                                                                                    Hmmm... (Was: C idioms (Was: >< swap operator)) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-10 07:56 +0000
                                                                                                                      Re: Hmmm... (Was: C idioms (Was: >< swap operator)) David Brown <david.brown@hesbynett.no> - 2018-10-10 10:32 +0200
                                                                                                                        Re: Hmmm... (Was: C idioms (Was: >< swap operator)) Ike Naar <ike@iceland.freeshell.org> - 2018-10-10 13:44 +0000
                                                                                                                          Re: Hmmm... (Was: C idioms (Was: >< swap operator)) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-10 14:52 +0000
                                                                                                                            Re: Hmmm... (Was: C idioms (Was: >< swap operator)) Wouter Verhelst <w@uter.be> - 2018-10-10 17:47 +0200
                                                                                                                          Re: Hmmm... (Was: C idioms (Was: >< swap operator)) David Brown <david.brown@hesbynett.no> - 2018-10-10 17:18 +0200
                                                                                                                            Re: Hmmm... (Was: C idioms (Was: >< swap operator)) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-10 15:22 +0000
                                                                                                                              Re: Hmmm... (Was: C idioms (Was: >< swap operator)) David Brown <david.brown@hesbynett.no> - 2018-10-10 23:58 +0200
                                                                                                                        Re: Hmmm... Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-10-10 07:51 -0600
                                                                                                                          Re: Hmmm... gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-10 14:53 +0000
                                                                                                                          Re: Hmmm... David Brown <david.brown@hesbynett.no> - 2018-10-10 17:21 +0200
                                                                                                                    Re: C idioms (Was: >< swap operator) scott@slp53.sl.home (Scott Lurndal) - 2018-10-10 12:57 +0000
                                                                                                                    Re: C idioms (Was: >< swap operator) James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-10-10 12:29 -0400
                                                                                                                      Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-11 00:07 +0200
                                                                                                                Re: C idioms (Was: >< swap operator) Keith Thompson <kst-u@mib.org> - 2018-10-09 14:50 -0700
                                                                                                                  Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-10 08:13 +0200
                                                                                                                Re: C idioms (Was: >< swap operator) scott@slp53.sl.home (Scott Lurndal) - 2018-10-10 12:56 +0000
                                                                                                                  Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-10 15:55 +0200
                                                                                                                    Re: C idioms (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-10 15:17 +0100
                                                                                                                      Re: C idioms (Was: >< swap operator) scott@slp53.sl.home (Scott Lurndal) - 2018-10-10 14:49 +0000
                                                                                                                        Fall-through in switch statements... (Was: C idioms (Was: >< swap operator)) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-10 14:59 +0000
                                                                                                                          Re: Fall-through in switch statements... (Was: C idioms (Was: >< swap operator)) Bart <bc@freeuk.com> - 2018-10-10 16:09 +0100
                                                                                                                            Re: Fall-through in switch statements... (Was: C idioms (Was: >< swap operator)) nobody@example.org (Scott) - 2018-10-10 17:29 +0000
                                                                                                                        Re: C idioms (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-10 16:01 +0100
                                                                                                                        Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-10 17:29 +0200
                                                                                                                          Re: C idioms (Was: >< swap operator) Wouter Verhelst <w@uter.be> - 2018-10-10 17:55 +0200
                                                                                                                            Re: C idioms (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-10 17:11 +0100
                                                                                                                            Re: C idioms Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-10 23:15 +0100
                                                                                                                            Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-11 00:16 +0200
                                                                                                                              Re: C idioms (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-10 23:23 +0100
                                                                                                                                Re: C idioms (Was: >< swap operator) Keith Thompson <kst-u@mib.org> - 2018-10-10 16:31 -0700
                                                                                                                              Re: C idioms (Was: >< swap operator) Keith Thompson <kst-u@mib.org> - 2018-10-10 15:32 -0700
                                                                                                                                Re: C idioms (Was: >< swap operator) Keith Thompson <kst-u@mib.org> - 2018-10-10 16:24 -0700
                                                                                                                                Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-11 10:52 +0200
                                                                                                                        Re: C idioms Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-10-10 09:59 -0600
                                                                                                                      Re: C idioms (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-10 17:26 +0200
                                                                                                                    Re: C idioms (Was: >< swap operator) scott@slp53.sl.home (Scott Lurndal) - 2018-10-10 14:48 +0000
                                                                                                                  Return values of fork() (Was: C idioms (Was: >< swap operator)) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-10 14:51 +0000
                                                                                                                    Re: Return values of fork() (Was: C idioms (Was: >< swap operator)) scott@slp53.sl.home (Scott Lurndal) - 2018-10-10 15:20 +0000
                                                                                                                      You know that and I know that, but ... (Was: Return values of fork() (Was: C idioms (Was: >< swap operator))) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-10 15:28 +0000
                                                                                                                        Re: You know that and I know that, but ... (Was: Return values of fork() (Was: C idioms (Was: >< swap operator))) David Brown <david.brown@hesbynett.no> - 2018-10-11 00:23 +0200
                                                                                                                          Re: You know that and I know that, but ... (Was: Return values of fork() (Was: C idioms (Was: >< swap operator))) scott@slp53.sl.home (Scott Lurndal) - 2018-10-11 13:22 +0000
                                                                                                                            Re: You know that and I know that, but ... (Was: Return values of fork() (Was: C idioms (Was: >< swap operator))) David Brown <david.brown@hesbynett.no> - 2018-10-11 15:58 +0200
                                                                                                                              Re: You know that and I know that, but ... (Was: Return values of fork() (Was: C idioms (Was: >< swap operator))) scott@slp53.sl.home (Scott Lurndal) - 2018-10-11 14:17 +0000
                                                                                                                                Re: You know that and I know that, but ... (Was: Return values of fork() (Was: C idioms (Was: >< swap operator))) David Brown <david.brown@hesbynett.no> - 2018-10-11 16:42 +0200
                                                                                                                                  Re: You know that and I know that, but ... (Was: Return values of fork() (Was: C idioms (Was: >< swap operator))) Wouter Verhelst <w@uter.be> - 2018-10-11 16:53 +0200
                                                                                                                                    Re: You know that and I know that, but ... (Was: Return values of fork() (Was: C idioms (Was: >< swap operator))) David Brown <david.brown@hesbynett.no> - 2018-10-11 20:11 +0200
                                                                                                                      Re: Return values of fork() (Was: C idioms (Was: >< swap operator)) David Brown <david.brown@hesbynett.no> - 2018-10-11 00:20 +0200
                                                                                                                        Re: Return values of fork() (Was: C idioms (Was: >< swap operator)) Keith Thompson <kst-u@mib.org> - 2018-10-10 16:15 -0700
                                                                                                                        Re: Return values of fork() Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-10-11 14:42 -0600
                                                                                                            Re: C idioms Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-10-09 16:18 -0600
                                                                                                              Re: C idioms gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-09 22:28 +0000
                                                                                                                Re: C idioms scott@slp53.sl.home (Scott Lurndal) - 2018-10-10 12:58 +0000
                                                                                                      Re: C idioms (Was: >< swap operator) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-09 07:48 -0700
                                                                                                        Re: C idioms Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-09 16:42 +0100
                                                                                                        Re: C idioms (Was: >< swap operator) Wouter Verhelst <w@uter.be> - 2018-10-09 19:40 +0200
                                                                                                          Re: C idioms (Was: >< swap operator) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-09 12:38 -0700
                                                                                                            Re: C idioms (Was: >< swap operator) Wouter Verhelst <w@uter.be> - 2018-10-09 23:41 +0200
                                                                                                      Re: C idioms (Was: >< swap operator) Wouter Verhelst <w@uter.be> - 2018-10-09 19:38 +0200
                                                                                                Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-07 15:04 +0100
                                                                                                  Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-07 16:37 +0100
                                                                                                    Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-07 16:58 +0100
                                                                                                      Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-07 12:17 -0400
                                                                                                    Grammar police! (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-07 20:37 +0000
                                                                                                  Re: >< swap operator jameskuyper@alumni.caltech.edu - 2018-10-07 09:31 -0700
                                                                                                    Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-07 18:09 +0100
                                                                                                      Re: >< swap operator jameskuyper@alumni.caltech.edu - 2018-10-07 14:05 -0700
                                                                                                        Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-07 22:35 +0100
                                                                                                          Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-08 02:56 +0100
                                                                                                          Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-08 10:48 +0200
                                                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 12:09 +0100
                                                                                                              Re: >< swap operator Ike Naar <ike@iceland.freeshell.org> - 2018-10-08 16:00 +0000
                                                                                                                Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 17:44 +0100
                                                                                                                  Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-08 10:39 -0700
                                                                                                                    Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 20:08 +0100
                                                                                                                      Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-09 11:22 +0200
                                                                                                                        Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-09 09:25 -0700
                                                                                                                          Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-09 20:43 +0200
                                                                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-09 20:15 +0100
                                                                                                                              Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-09 22:26 +0200
                                                                                                                  Re: >< swap operator Ike Naar <ike@iceland.freeshell.org> - 2018-10-08 21:09 +0000
                                                                                                                    Re: >< swap operator David Kleinecke <dkleinecke@gmail.com> - 2018-10-08 15:18 -0700
                                                                                                            Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-08 07:55 -0700
                                                                                                              Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-09 11:24 +0200
                                                                                                          Re: >< swap operator jameskuyper@alumni.caltech.edu - 2018-10-08 07:19 -0700
                                                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 16:26 +0100
                                                                                                              Re: >< swap operator jameskuyper@alumni.caltech.edu - 2018-10-10 10:59 -0700
                                                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 19:53 +0100
                                                                                                        Re: >< swap operator James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-10-07 18:00 -0400
                                                                                                        Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-07 17:10 -0700
                                                                                                          Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 01:25 +0100
                                                                                                            Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-08 02:51 +0100
                                                                                                              Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 11:29 +0100
                                                                                                                Re: >< swap operator mark.bluemel@gmail.com - 2018-10-08 04:41 -0700
                                                                                                                Re: >< swap operator jameskuyper@alumni.caltech.edu - 2018-10-08 07:56 -0700
                                                                                                                Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-08 08:36 -0700
                                                                                                                  Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 17:34 +0100
                                                                                                                    Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-08 21:35 +0100
                                                                                                                      Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 22:00 +0100
                                                                                                                        Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-09 00:47 +0100
                                                                                                                          Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-09 01:11 +0100
                                                                                                                            Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-09 02:47 +0100
                                                                                                                              Re: >< swap operator mark.bluemel@gmail.com - 2018-10-09 00:49 -0700
                                                                                                                                Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-09 11:28 +0100
                                                                                                                                Re: >< swap operator gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-09 13:00 +0000
                                                                                                                  Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-08 10:28 -0700
                                                                                                                    Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-08 10:49 -0700
                                                                                                            Re: >< swap operator Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-10-07 20:00 -0600
                                                                                          Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-06 13:07 -0700
                                                                                    Re: >< swap operator gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-05 23:35 +0000
                                                                                    Re: >< swap operator Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-06 03:49 -0700
                                                                                      Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-06 16:18 +0200
                                                                                        Re: >< swap operator scott@slp53.sl.home (Scott Lurndal) - 2018-10-06 14:48 +0000
                                                                                          Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-06 12:53 -0700
                                                                                            Re: >< swap operator scott@slp53.sl.home (Scott Lurndal) - 2018-10-07 16:38 +0000
                                                                                              Re: >< swap operator James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-10-07 15:56 -0400
                                                                                              Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-07 16:53 -0700
                                                                                                Re: >< swap operator David Kleinecke <dkleinecke@gmail.com> - 2018-10-07 17:07 -0700
                                                                                                  Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-07 17:24 -0700
                                                                                                    Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-08 01:30 +0100
                                                                                                      Re: >< swap operator Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-10-07 19:12 -0600
                                                                                      Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 18:26 +0100
                                                                                        Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-06 19:41 +0100
                                                                                          Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-06 13:05 -0700
                                                                                            Re: >< swap operator Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-07 02:24 -0700
                                                                                              Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-07 12:41 +0200
                                                                              100% of the user base... (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-06 00:22 +0000
                                                                                Re: 100% of the user base... (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-06 01:55 +0100
                                                                                  Re: 100% of the user base... (Was: >< swap operator) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-06 03:58 -0700
                                                                                    Re: 100% of the user base... (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-06 11:51 +0000
                                                                                      Re: 100% of the user base... (Was: >< swap operator) Bart <bc@freeuk.com> - 2018-10-06 13:09 +0100
                                                                                        Re: 100% of the user base... (Was: >< swap operator) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-06 05:26 -0700
                                                                                          Re: 100% of the user base... (Was: >< swap operator) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-06 05:40 -0700
                                                                                            Re: 100% of the user base... (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-06 12:46 +0000
                                                                                            Re: 100% of the user base... (Was: >< swap operator) Melzzzzz <Melzzzzz@zzzzz.com> - 2018-10-06 12:46 +0000
                                                                                              Re: 100% of the user base... (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-06 12:49 +0000
                                                                                                Re: 100% of the user base... (Was: >< swap operator) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-06 06:27 -0700
                                                                                                  Re: 100% of the user base... (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-07 12:47 +0000
                                                                                                    Re: 100% of the user base... (Was: >< swap operator) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-07 09:03 -0400
                                                                                                      Re: 100% of the user base... (Was: >< swap operator) scott@slp53.sl.home (Scott Lurndal) - 2018-10-07 16:47 +0000
                                                                            Re: >< swap operator Wouter Verhelst <w@uter.be> - 2018-10-05 10:17 +0200
                                                                        Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-05 09:20 +0200
                                                                          Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-05 10:58 +0100
                                                                            Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-05 12:09 +0200
                                                                    Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-05 03:11 +0100
                                                                      Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 07:56 -0400
                                                                        Re: >< swap operator Wouter Verhelst <w@uter.be> - 2018-10-05 14:25 +0200
                                                                          Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 08:39 -0400
                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-05 15:47 +0100
                                                                            Re: >< swap operator Wouter Verhelst <w@uter.be> - 2018-10-05 17:30 +0200
                                                                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 11:41 -0400
                                                                                Re: >< swap operator Wouter Verhelst <w@uter.be> - 2018-10-05 17:56 +0200
                                                                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 12:00 -0400
                                                                            Re: >< swap operator Richard Damon <Richard@Damon-Family.org> - 2018-10-05 12:34 -0400
                                                                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 12:48 -0400
                                                                                Re: >< swap operator Richard Damon <Richard@Damon-Family.org> - 2018-10-05 13:55 -0400
                                                                                  Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-05 11:20 -0700
                                                                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 14:45 -0400
                                                                                    Re: >< swap operator Richard Damon <Richard@Damon-Family.org> - 2018-10-05 21:39 -0400
                                                                                      Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-07 08:51 -0400
                                                                                    Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-11-25 14:18 -0800
                                                                        Re: >< swap operator Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-10-05 15:46 +0300
                                                                          Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 06:05 -0700
                                                                            Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 06:16 -0700
                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-05 15:09 +0100
                                                                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 10:18 -0400
                                                                                Re: >< swap operator Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-10-05 17:32 +0300
                                                                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 10:34 -0400
                                                                                  Of course it is crazy! (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-05 15:17 +0000
                                                                          Re: >< swap operator gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-05 18:30 +0000
                                                                            Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 14:48 -0400
                                                                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 15:06 -0400
                                                                        Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-05 13:55 +0100
                                                                          Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 06:14 -0700
                                                                            Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-05 16:18 +0200
                                                                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 10:21 -0400
                                                                                Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-05 17:27 +0200
                                                                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-05 15:26 +0100
                                                                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 10:28 -0400
                                                                                Re: >< swap operator gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-05 14:46 +0000
                                                                              When pigs fly... (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-05 16:10 +0000
                                                                            Re: >< swap operator Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-10-05 17:35 +0300
                                                                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 10:46 -0400
                                                                              Re: >< swap operator gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-05 15:15 +0000
                                                                          6K years??? (Was: >< swap operator) gazelle@shell.xmission.com (Kenny McCormack) - 2018-10-05 13:20 +0000
                                                                            Re: 6K years??? (Was: >< swap operator) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 09:28 -0400
                                                                              Re: 6K years??? (Was: >< swap operator) Wouter Verhelst <w@uter.be> - 2018-10-05 17:53 +0200
                                                                                Re: 6K years??? (Was: >< swap operator) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 11:56 -0400
                                                                                  Re: 6K years??? (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-05 18:17 +0200
                                                                                    Re: 6K years??? (Was: >< swap operator) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 09:21 -0700
                                                                                      Re: 6K years??? (Was: >< swap operator) David Brown <david.brown@hesbynett.no> - 2018-10-05 18:50 +0200
                                                                                        Re: 6K years??? (Was: >< swap operator) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 12:52 -0400
                                                                                          Re: 6K years??? (Was: >< swap operator) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-05 13:05 -0400
                                                                                        Re: 6K years??? (Was: >< swap operator) Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-06 03:42 -0700
                                                                        Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-05 15:59 +0200
                                                                        Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-06 03:45 +0100
                                                                  Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-04 11:22 -0700
                                                                    Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 20:35 +0100
                                                              Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-04 13:28 +0100
                                                                Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-10-04 17:59 +0100
                                                      Re: >< swap operator John Bode <jfbode1029@gmail.com> - 2018-10-04 09:56 -0700
                                            Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 06:03 -0700
                                              Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-03 14:37 +0100
                                                Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 09:51 -0400
                                              Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-03 15:39 +0200
                                                Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 10:05 -0400
                                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 10:09 -0400
                                                  Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-03 16:22 +0200
                                                    Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 10:29 -0400
                                                      Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-03 20:52 +0200
                                                        Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-03 14:57 -0400
                                      Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-02 16:06 -0700
                                        Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-03 00:09 +0100
                                        Re: >< swap operator Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2018-10-02 19:21 -0400
                                      Re: >< swap operator David Brown <david.brown@hesbynett.no> - 2018-10-03 11:21 +0200
                                  Re: >< swap operator Thiago Adams <thiago.adams@gmail.com> - 2018-10-02 13:43 -0700
                                  Re: >< swap operator scott@slp53.sl.home (Scott Lurndal) - 2018-10-02 21:01 +0000
                                    Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-02 14:29 -0700
                                    Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 22:37 +0100
                                      Re: >< swap operator Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-03 05:07 -0700
                            Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 21:01 +0100
                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 16:06 -0400
                                Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 21:45 +0100
                                  Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 17:09 -0400
                              Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 16:11 -0400
                                Re: >< swap operator "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-10-02 16:22 -0400
                              Re: >< swap operator Thiago Adams <thiago.adams@gmail.com> - 2018-10-02 13:17 -0700
                                Re: >< swap operator Thiago Adams <thiago.adams@gmail.com> - 2018-10-02 13:24 -0700
                    Re: >< swap operator scott@slp53.sl.home (Scott Lurndal) - 2018-10-02 15:04 +0000
                    Re: >< swap operator Niles Rogoff <eternal-september@niles.xyz> - 2018-10-03 18:28 +0000
    Re: >< swap operator Thiago Adams <thiago.adams@gmail.com> - 2018-08-14 11:50 -0700
    Re: >< swap operator Siri Cruise <chine.bleu@yahoo.com> - 2018-08-14 17:07 -0700
      Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-15 02:22 -0700
        Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-15 02:34 -0700
          Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-15 03:09 -0700
        Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-15 03:24 -0700
          Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-15 04:51 -0700
            Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-15 05:06 -0700
        Re: >< swap operator Siri Cruise <chine.bleu@yahoo.com> - 2018-08-15 04:21 -0700
          Re: >< swap operator Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-08-15 14:43 +0100
            Re: >< swap operator fir <profesor.fir@gmail.com> - 2018-08-15 07:08 -0700
            Re: >< swap operator Bart <bc@freeuk.com> - 2018-08-15 16:52 +0100
          Re: >< swap operator Ike Naar <ike@iceland.freeshell.org> - 2018-08-15 15:51 +0000
    Re: >< swap operator John Bode <jfbode1029@gmail.com> - 2018-10-01 14:59 -0700
      Re: >< swap operator Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-10-02 03:06 -0700
      Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 11:43 +0100
        Re: >< swap operator John Bode <jfbode1029@gmail.com> - 2018-10-02 07:27 -0700
          Re: >< swap operator Bart <bc@freeuk.com> - 2018-10-02 15:43 +0100
            Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-02 11:01 -0700
          Re: >< swap operator Keith Thompson <kst-u@mib.org> - 2018-10-02 10:54 -0700
            Re: >< swap operator Thiago Adams <thiago.adams@gmail.com> - 2018-10-02 12:39 -0700
    Re: >< swap operator skybuck2000@hotmail.com - 2018-10-10 18:10 -0700
    Re: >< swap operator skybuck2000@hotmail.com - 2018-10-10 18:24 -0700

Page 6 of 18 — ← Prev page 1 … 4 5 [6] 7 8 … 18  Next page →


#136519 — Re: C idioms (Was: >< swap operator)

FromDavid Brown <david.brown@hesbynett.no>
Date2018-10-10 08:07 +0200
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<ppk4v4$kqa$1@dont-email.me>
In reply to#136512
On 09/10/18 23:45, jameskuyper@alumni.caltech.edu wrote:
> On Tuesday, October 9, 2018 at 4:58:32 PM UTC-4, David Brown wrote:
> ...
>> ... I
>> am not particularly familiar with the details of fork() - it is not a
>> standard C call, and for all I know it could return a range of negative
>> error values.
> 
>  From The Open Group Base Specifications Issue 7, 2018 edition
> IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008):
> 
> | Upon successful completion, fork() shall return 0 to the child process
> | and shall return the process ID of the child process to the parent
> | process. Both processes shall continue to execute from the fork()
> | function. Otherwise, -1 shall be returned to the parent process, no
> | child process shall be created, and errno shall be set to indicate the
> | error.
> 

OK.  If -1 is the only possible error return, then fair enough.

>> I still see no advantage of "switch" over "if" for such code - unless it
>> is viewed as such a common idiom that the familiarity is an advantage.
> 
> I think it makes the code slightly simpler, I see no reason to object to
> it. I think anyone daring to modify such code should either know what
> values fork() can return, or be able to find out quickly.
> 

I don't think the switch makes the code simpler.  I don't object to it 
particularly either, and I certainly agree that you don't /change/ code 
like this without very good reason.  I simply don't see any advantage of 
using "switch" instead of "if" for this kind of code.

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


#136522 — Hmmm... (Was: C idioms (Was: >< swap operator))

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2018-10-10 07:56 +0000
SubjectHmmm... (Was: C idioms (Was: >< swap operator))
Message-ID<ppkbbm$ovl$1@news.xmission.com>
In reply to#136519
In article <ppk4v4$kqa$1@dont-email.me>,
David Brown  <david.brown@hesbynett.no> wrote:
...
>like this without very good reason.  I simply don't see any advantage of 
>using "switch" instead of "if" for this kind of code.

Pity.  I may have to re-think my "You're not a moron" stance.

-- 

Prayer has no place in the public schools, just like facts
have no place in organized religion.
 -- Superintendent Chalmers

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


#136523 — Re: Hmmm... (Was: C idioms (Was: >< swap operator))

FromDavid Brown <david.brown@hesbynett.no>
Date2018-10-10 10:32 +0200
SubjectRe: Hmmm... (Was: C idioms (Was: >< swap operator))
Message-ID<ppkdei$tfn$1@dont-email.me>
In reply to#136522
On 10/10/18 09:56, Kenny McCormack wrote:
> In article <ppk4v4$kqa$1@dont-email.me>,
> David Brown  <david.brown@hesbynett.no> wrote:
> ...
>> like this without very good reason.  I simply don't see any advantage of 
>> using "switch" instead of "if" for this kind of code.
> 
> Pity.  I may have to re-think my "You're not a moron" stance.
> 

I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
better here.  I'll change my opinion if I see good enough reasons.

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


#136532 — Re: Hmmm... (Was: C idioms (Was: >< swap operator))

FromIke Naar <ike@iceland.freeshell.org>
Date2018-10-10 13:44 +0000
SubjectRe: Hmmm... (Was: C idioms (Was: >< swap operator))
Message-ID<slrn3ubgprs0he.q4p.ike@iceland.freeshell.org>
In reply to#136523
On 2018-10-10, David Brown <david.brown@hesbynett.no> wrote:
> On 10/10/18 09:56, Kenny McCormack wrote:
>> In article <ppk4v4$kqa$1@dont-email.me>,
>> David Brown  <david.brown@hesbynett.no> wrote:
>> ...
>>> like this without very good reason.  I simply don't see any advantage of 
>>> using "switch" instead of "if" for this kind of code.
>> 
>> Pity.  I may have to re-think my "You're not a moron" stance.
>> 
>
> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
> better here.  I'll change my opinion if I see good enough reasons.

With 'if' a variable is always required to store the pid.
With 'switch' one can do without such a variable if the pid is not
used for another purpose than for branching on child/parent/error cases.

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


#136543 — Re: Hmmm... (Was: C idioms (Was: >< swap operator))

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2018-10-10 14:52 +0000
SubjectRe: Hmmm... (Was: C idioms (Was: >< swap operator))
Message-ID<ppl3n4$6ac$2@news.xmission.com>
In reply to#136532
In article <slrn3ubgprs0he.q4p.ike@iceland.freeshell.org>,
Ike Naar  <ike@iceland.freeshell.org> wrote:
>On 2018-10-10, David Brown <david.brown@hesbynett.no> wrote:
>> On 10/10/18 09:56, Kenny McCormack wrote:
>>> In article <ppk4v4$kqa$1@dont-email.me>,
>>> David Brown  <david.brown@hesbynett.no> wrote:
>>> ...
>>>> like this without very good reason.  I simply don't see any advantage of 
>>>> using "switch" instead of "if" for this kind of code.
>>> 
>>> Pity.  I may have to re-think my "You're not a moron" stance.
>>> 
>>
>> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
>> better here.  I'll change my opinion if I see good enough reasons.
>
>With 'if' a variable is always required to store the pid.
>With 'switch' one can do without such a variable if the pid is not
>used for another purpose than for branching on child/parent/error cases.

Well said, sir!

Indeed, most of the time, you don't really need the pid.  You just want to
make sure it isn't zero or minus one.

-- 
The randomly chosen signature file that would have appeared here is more than 4
lines long.  As such, it violates one or more Usenet RFCs.  In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
	http://user.xmission.com/~gazelle/Sigs/WeekendAwayFromHome

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


#136555 — Re: Hmmm... (Was: C idioms (Was: >< swap operator))

FromWouter Verhelst <w@uter.be>
Date2018-10-10 17:47 +0200
SubjectRe: Hmmm... (Was: C idioms (Was: >< swap operator))
Message-ID<dhj19f-s5f.ln1@gangtai.home.grep.be>
In reply to#136543
On 10/10/18 16:52, Kenny McCormack wrote:
> In article <slrn3ubgprs0he.q4p.ike@iceland.freeshell.org>,
> Ike Naar  <ike@iceland.freeshell.org> wrote:
>> On 2018-10-10, David Brown <david.brown@hesbynett.no> wrote:
>>> On 10/10/18 09:56, Kenny McCormack wrote:
>>>> In article <ppk4v4$kqa$1@dont-email.me>,
>>>> David Brown  <david.brown@hesbynett.no> wrote:
>>>> ...
>>>>> like this without very good reason.  I simply don't see any advantage of 
>>>>> using "switch" instead of "if" for this kind of code.
>>>>
>>>> Pity.  I may have to re-think my "You're not a moron" stance.
>>>>
>>>
>>> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
>>> better here.  I'll change my opinion if I see good enough reasons.
>>
>> With 'if' a variable is always required to store the pid.
>> With 'switch' one can do without such a variable if the pid is not
>> used for another purpose than for branching on child/parent/error cases.
> 
> Well said, sir!
> 
> Indeed, most of the time, you don't really need the pid.  You just want to
> make sure it isn't zero or minus one.

For clarity:

I gave that example because it was the first example I could come up
with where I thought a switch wouldn't work. Unfortunately it wasn't a
good example. So, let's try this:

if((number = getRandomValue()) < 0) {
  printf("negative!\n");
  ... // handle negative numbers
} else if (number == 0) {
  printf("zero!\n");
  ... // handle zero
} else {
  printf("positive!\n");
  ... // handle positive numbers
}

It doesn't matter what the actual getRandomValue() function is. The
point of my post was not "how do you cleanly store a PID and handle all
the cases" (which I now see can, indeed, be done with a switch), the
point was "how do you cleanly handle a multiple select that can't be
done with a switch".

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


#136548 — Re: Hmmm... (Was: C idioms (Was: >< swap operator))

FromDavid Brown <david.brown@hesbynett.no>
Date2018-10-10 17:18 +0200
SubjectRe: Hmmm... (Was: C idioms (Was: >< swap operator))
Message-ID<ppl58p$2er$1@dont-email.me>
In reply to#136532
On 10/10/18 15:44, Ike Naar wrote:
> On 2018-10-10, David Brown <david.brown@hesbynett.no> wrote:
>> On 10/10/18 09:56, Kenny McCormack wrote:
>>> In article <ppk4v4$kqa$1@dont-email.me>,
>>> David Brown  <david.brown@hesbynett.no> wrote:
>>> ...
>>>> like this without very good reason.  I simply don't see any advantage of 
>>>> using "switch" instead of "if" for this kind of code.
>>>
>>> Pity.  I may have to re-think my "You're not a moron" stance.
>>>
>>
>> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
>> better here.  I'll change my opinion if I see good enough reasons.
> 
> With 'if' a variable is always required to store the pid.
> With 'switch' one can do without such a variable if the pid is not
> used for another purpose than for branching on child/parent/error cases.
> 

OK, that is one point.  It is completely lost when you write, as some do,

	switch (pid = fork()) ...

Often (but not always) you need the pid of the child anyway.

Even when you don't need it, I don't see a big cost in defining a
variable to hold the pid.

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


#136551 — Re: Hmmm... (Was: C idioms (Was: >< swap operator))

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2018-10-10 15:22 +0000
SubjectRe: Hmmm... (Was: C idioms (Was: >< swap operator))
Message-ID<ppl5fm$6ac$5@news.xmission.com>
In reply to#136548
In article <ppl58p$2er$1@dont-email.me>,
David Brown  <david.brown@hesbynett.no> wrote:
>On 10/10/18 15:44, Ike Naar wrote:
>> On 2018-10-10, David Brown <david.brown@hesbynett.no> wrote:
>>> On 10/10/18 09:56, Kenny McCormack wrote:
>>>> In article <ppk4v4$kqa$1@dont-email.me>,
>>>> David Brown  <david.brown@hesbynett.no> wrote:
>>>> ...
>>>>> like this without very good reason.  I simply don't see any advantage of 
>>>>> using "switch" instead of "if" for this kind of code.
>>>>
>>>> Pity.  I may have to re-think my "You're not a moron" stance.
>>>>
>>>
>>> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
>>> better here.  I'll change my opinion if I see good enough reasons.
>> 
>> With 'if' a variable is always required to store the pid.
>> With 'switch' one can do without such a variable if the pid is not
>> used for another purpose than for branching on child/parent/error cases.
>> 
>
>OK, that is one point.  It is completely lost when you write, as some do,
>
>	switch (pid = fork()) ...
>
>Often (but not always) you need the pid of the child anyway.
>
>Even when you don't need it, I don't see a big cost in defining a
>variable to hold the pid.
>

You're just painting yourself into a corner.

One of the many advantages of 'switch' here is that you don't need the aux
variable at least some of the time (we can argue about percentages, but
it'd just be speculation) whereas, with 'if', you always need it (*).

(*) Unless you're willing to ignore the error case, since that "never"
happens in real life...

-- 
The randomly chosen signature file that would have appeared here is more than 4
lines long.  As such, it violates one or more Usenet RFCs.  In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
	http://user.xmission.com/~gazelle/Sigs/CLCtopics

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


#136582 — Re: Hmmm... (Was: C idioms (Was: >< swap operator))

FromDavid Brown <david.brown@hesbynett.no>
Date2018-10-10 23:58 +0200
SubjectRe: Hmmm... (Was: C idioms (Was: >< swap operator))
Message-ID<pplsmr$p1i$1@dont-email.me>
In reply to#136551
On 10/10/18 17:22, Kenny McCormack wrote:
> In article <ppl58p$2er$1@dont-email.me>,
> David Brown  <david.brown@hesbynett.no> wrote:
>> On 10/10/18 15:44, Ike Naar wrote:
>>> On 2018-10-10, David Brown <david.brown@hesbynett.no> wrote:
>>>> On 10/10/18 09:56, Kenny McCormack wrote:
>>>>> In article <ppk4v4$kqa$1@dont-email.me>,
>>>>> David Brown  <david.brown@hesbynett.no> wrote:
>>>>> ...
>>>>>> like this without very good reason.  I simply don't see any advantage of
>>>>>> using "switch" instead of "if" for this kind of code.
>>>>>
>>>>> Pity.  I may have to re-think my "You're not a moron" stance.
>>>>>
>>>>
>>>> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
>>>> better here.  I'll change my opinion if I see good enough reasons.
>>>
>>> With 'if' a variable is always required to store the pid.
>>> With 'switch' one can do without such a variable if the pid is not
>>> used for another purpose than for branching on child/parent/error cases.
>>>
>>
>> OK, that is one point.  It is completely lost when you write, as some do,
>>
>> 	switch (pid = fork()) ...
>>
>> Often (but not always) you need the pid of the child anyway.
>>
>> Even when you don't need it, I don't see a big cost in defining a
>> variable to hold the pid.
>>
> 
> You're just painting yourself into a corner.
> 

Not at all.

> One of the many advantages of 'switch' here is that you don't need the aux
> variable at least some of the time (we can argue about percentages, but
> it'd just be speculation) whereas, with 'if', you always need it (*).

We've covered that switch does not need a variable, unless the variable 
is used elsewhere in the code.  (And I won'd argue about the percentages 
here.)  Fair enough - that is an advantage of the switch.  The cost of 
the variable is one line of code with no run-time or code costs 
(assuming a sane compiler) - it is a cost, but not a very significant one.

If that is "one of the many advantages of switch", then surely you can 
tell me what you see as the other ones?

> 
> (*) Unless you're willing to ignore the error case, since that "never"
> happens in real life...
> 

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


#136534 — Re: Hmmm...

FromJoe Pfeiffer <pfeiffer@cs.nmsu.edu>
Date2018-10-10 07:51 -0600
SubjectRe: Hmmm...
Message-ID<1bo9c129lq.fsf@pfeifferfamily.net>
In reply to#136523
David Brown <david.brown@hesbynett.no> writes:

> On 10/10/18 09:56, Kenny McCormack wrote:
>> In article <ppk4v4$kqa$1@dont-email.me>,
>> David Brown  <david.brown@hesbynett.no> wrote:
>> ...
>>> like this without very good reason.  I simply don't see any advantage of 
>>> using "switch" instead of "if" for this kind of code.
>> 
>> Pity.  I may have to re-think my "You're not a moron" stance.
>> 
>
> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
> better here.  I'll change my opinion if I see good enough reasons.

I generally prefer switches over chains of if...else if... else when
possible because it more clearly says "this is the set of possible
alternatives" rather than "try this, then this, then this..." (to my
eye, anyway).

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


#136544 — Re: Hmmm...

Fromgazelle@shell.xmission.com (Kenny McCormack)
Date2018-10-10 14:53 +0000
SubjectRe: Hmmm...
Message-ID<ppl3ot$6ac$3@news.xmission.com>
In reply to#136534
In article <1bo9c129lq.fsf@pfeifferfamily.net>,
Joe Pfeiffer  <pfeiffer@cs.nmsu.edu> wrote:
>David Brown <david.brown@hesbynett.no> writes:
>
>> On 10/10/18 09:56, Kenny McCormack wrote:
>>> In article <ppk4v4$kqa$1@dont-email.me>,
>>> David Brown  <david.brown@hesbynett.no> wrote:
>>> ...
>>>> like this without very good reason.  I simply don't see any advantage of 
>>>> using "switch" instead of "if" for this kind of code.
>>> 
>>> Pity.  I may have to re-think my "You're not a moron" stance.
>>> 
>>
>> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
>> better here.  I'll change my opinion if I see good enough reasons.
>
>I generally prefer switches over chains of if...else if... else when
>possible because it more clearly says "this is the set of possible
>alternatives" rather than "try this, then this, then this..." (to my
>eye, anyway).
>

Indeed.  Well said, sir.

I strongly dislike "if" chains and try to use switch/case if at all
possible.

Regardless of which language I'm using at the time...

-- 
The randomly chosen signature file that would have appeared here is more than 4
lines long.  As such, it violates one or more Usenet RFCs.  In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
	http://user.xmission.com/~gazelle/Sigs/RepInsults

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


#136550 — Re: Hmmm...

FromDavid Brown <david.brown@hesbynett.no>
Date2018-10-10 17:21 +0200
SubjectRe: Hmmm...
Message-ID<ppl5do$2er$2@dont-email.me>
In reply to#136534
On 10/10/18 15:51, Joe Pfeiffer wrote:
> David Brown <david.brown@hesbynett.no> writes:
> 
>> On 10/10/18 09:56, Kenny McCormack wrote:
>>> In article <ppk4v4$kqa$1@dont-email.me>,
>>> David Brown  <david.brown@hesbynett.no> wrote:
>>> ...
>>>> like this without very good reason.  I simply don't see any advantage of 
>>>> using "switch" instead of "if" for this kind of code.
>>>
>>> Pity.  I may have to re-think my "You're not a moron" stance.
>>>
>>
>> I'd be happy to listen to /why/ you (or anyone else) thinks a switch is
>> better here.  I'll change my opinion if I see good enough reasons.
> 
> I generally prefer switches over chains of if...else if... else when
> possible because it more clearly says "this is the set of possible
> alternatives" rather than "try this, then this, then this..." (to my
> eye, anyway).
> 

If it were a chain of == comparisons, especially when the choices are
balanced, then I would agree.  This case is not a chain in that way - it
is a set of three independent possibilities.

Yes, an "if" gives a specific ordering for the checks, which a "switch"
normally does not.  But that makes no practical difference here.

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


#136528 — Re: C idioms (Was: >< swap operator)

Fromscott@slp53.sl.home (Scott Lurndal)
Date2018-10-10 12:57 +0000
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<XGmvD.59809$un2.47900@fx14.iad>
In reply to#136519
David Brown <david.brown@hesbynett.no> writes:
>On 09/10/18 23:45, jameskuyper@alumni.caltech.edu wrote:
>> On Tuesday, October 9, 2018 at 4:58:32 PM UTC-4, David Brown wrote:
>> ...
>>> ... I
>>> am not particularly familiar with the details of fork() - it is not a
>>> standard C call, and for all I know it could return a range of negative
>>> error values.
>> 
>>  From The Open Group Base Specifications Issue 7, 2018 edition
>> IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008):
>> 
>> | Upon successful completion, fork() shall return 0 to the child process
>> | and shall return the process ID of the child process to the parent
>> | process. Both processes shall continue to execute from the fork()
>> | function. Otherwise, -1 shall be returned to the parent process, no
>> | child process shall be created, and errno shall be set to indicate the
>> | error.
>> 
>
>OK.  If -1 is the only possible error return, then fair enough.
>

I will note that all the cases I enumerated up-thread were from
the SVR4 source base.

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


#136560 — Re: C idioms (Was: >< swap operator)

FromJames Kuyper <jameskuyper@alumni.caltech.edu>
Date2018-10-10 12:29 -0400
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<ppl9dk$ssk$1@dont-email.me>
In reply to#136519
On 10/10/2018 02:07 AM, David Brown wrote:
> On 09/10/18 23:45, jameskuyper@alumni.caltech.edu wrote:
>> On Tuesday, October 9, 2018 at 4:58:32 PM UTC-4, David Brown wrote:
>> ...
>>> ... I
>>> am not particularly familiar with the details of fork() - it is not a
>>> standard C call, and for all I know it could return a range of negative
>>> error values.
>>
>>  From The Open Group Base Specifications Issue 7, 2018 edition
>> IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008):
>>
>> | Upon successful completion, fork() shall return 0 to the child process
>> | and shall return the process ID of the child process to the parent
>> | process. Both processes shall continue to execute from the fork()
>> | function. Otherwise, -1 shall be returned to the parent process, no
>> | child process shall be created, and errno shall be set to indicate the
>> | error.
>>
> 
> OK.  If -1 is the only possible error return, then fair enough.
> 
>>> I still see no advantage of "switch" over "if" for such code - unless it
>>> is viewed as such a common idiom that the familiarity is an advantage.
>>
>> I think it makes the code slightly simpler, I see no reason to object to
>> it. I think anyone daring to modify such code should either know what
>> values fork() can return, or be able to find out quickly.
>>
> 
> I don't think the switch makes the code simpler.  I don't object to it 
> particularly either, and I certainly agree that you don't /change/ code 
> like this without very good reason.  I simply don't see any advantage of 
> using "switch" instead of "if" for this kind of code.
> 

if((pid = fork) == -1)
{
	// Handle error
}
else if(pid == 0)
{
	// Handle as child
}
else
{
	// Handle as parent
}

vs.
switch(pid = fork())
{
case -1:	// Handle error
	break;
case 0:		// Handle as child
	break;
default:	// Handle as parent
	break;
}

It's a matter of judgment, but my judgment is that the second version is
(marginally) simpler and easier to understand.

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


#136585 — Re: C idioms (Was: >< swap operator)

FromDavid Brown <david.brown@hesbynett.no>
Date2018-10-11 00:07 +0200
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<pplt7k$rqt$1@dont-email.me>
In reply to#136560
On 10/10/18 18:29, James Kuyper wrote:
> On 10/10/2018 02:07 AM, David Brown wrote:
>> On 09/10/18 23:45, jameskuyper@alumni.caltech.edu wrote:
>>> On Tuesday, October 9, 2018 at 4:58:32 PM UTC-4, David Brown wrote:
>>> ...
>>>> ... I
>>>> am not particularly familiar with the details of fork() - it is not a
>>>> standard C call, and for all I know it could return a range of negative
>>>> error values.
>>>
>>>   From The Open Group Base Specifications Issue 7, 2018 edition
>>> IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008):
>>>
>>> | Upon successful completion, fork() shall return 0 to the child process
>>> | and shall return the process ID of the child process to the parent
>>> | process. Both processes shall continue to execute from the fork()
>>> | function. Otherwise, -1 shall be returned to the parent process, no
>>> | child process shall be created, and errno shall be set to indicate the
>>> | error.
>>>
>>
>> OK.  If -1 is the only possible error return, then fair enough.
>>
>>>> I still see no advantage of "switch" over "if" for such code - unless it
>>>> is viewed as such a common idiom that the familiarity is an advantage.
>>>
>>> I think it makes the code slightly simpler, I see no reason to object to
>>> it. I think anyone daring to modify such code should either know what
>>> values fork() can return, or be able to find out quickly.
>>>
>>
>> I don't think the switch makes the code simpler.  I don't object to it
>> particularly either, and I certainly agree that you don't /change/ code
>> like this without very good reason.  I simply don't see any advantage of
>> using "switch" instead of "if" for this kind of code.
>>
> 
> if((pid = fork) == -1)
> {
> 	// Handle error
> }
> else if(pid == 0)
> {
> 	// Handle as child
> }
> else
> {
> 	// Handle as parent
> }
> 
> vs.
> switch(pid = fork())
> {
> case -1:	// Handle error
> 	break;
> case 0:		// Handle as child
> 	break;
> default:	// Handle as parent
> 	break;
> }
> 
> It's a matter of judgment, but my judgment is that the second version is
> (marginally) simpler and easier to understand.
> 

vs.

if ((pid = fork()) == -1) {
	// Handle error
	...
} else if (pid == 0) {
	// Handle as child
	...
} else {
	// Handle as parent
	...
}

With a more compact bracing style, it is (IMHO - and it is entirely an 
opinion) neater and clearer.  The braces and indenting are consistent, 
local variables within each block are local to the block without adding 
"freestanding" braces, and you don't have the "break" to close your blocks.

To my reading (and again, this is opinion, preference or personal 
judgement), the "default" clause of a "switch" statement is for the 
left-overs - odd situations that are not handled by the normal cases, or 
an error situation for values that were unexpected.  Using it here does 
not match the symmetry of the call (for which 50% of the calls will give 
a pid of 0, 50% will give a positive pid, and hopefully only a tiny 
fraction will give -1).

I am happy to accept that some people judge the "switch" to be 
aesthetically nicer, simpler or clearer in some way, even though I don't 
see it that way myself.  I am merely trying to establish if there are 
any objective points I have missed.

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


#136513 — Re: C idioms (Was: >< swap operator)

FromKeith Thompson <kst-u@mib.org>
Date2018-10-09 14:50 -0700
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<ln1s8yzt6a.fsf@kst-u.example.com>
In reply to#136509
David Brown <david.brown@hesbynett.no> writes:
[...]
> These do not match the original code, which tested for pid being less 
> than, equal to or greater than 0.  You can't do that with a switch.  I 
> am not particularly familiar with the details of fork() - it is not a 
> standard C call, and for all I know it could return a range of negative 
> error values.
[...]

Somebody already mentioned that fork(), which is defined by POSIX, is
defined to return -1 on error, not just any arbitrary negative value.

(Why speculate when you can look it up?)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


#136521 — Re: C idioms (Was: >< swap operator)

FromDavid Brown <david.brown@hesbynett.no>
Date2018-10-10 08:13 +0200
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<ppk5at$mk7$1@dont-email.me>
In reply to#136513
On 09/10/18 23:50, Keith Thompson wrote:
> David Brown <david.brown@hesbynett.no> writes:
> [...]
>> These do not match the original code, which tested for pid being less
>> than, equal to or greater than 0.  You can't do that with a switch.  I
>> am not particularly familiar with the details of fork() - it is not a
>> standard C call, and for all I know it could return a range of negative
>> error values.
> [...]
> 
> Somebody already mentioned that fork(), which is defined by POSIX, is
> defined to return -1 on error, not just any arbitrary negative value.
> 
> (Why speculate when you can look it up?)
> 

Yes, but why bother with it at all?  It was totally irrelevant to the 
point in question, making an arbitrary change ("if" to "switch") to the 
code structure that required additional knowledge about the function 
being called.

The discussion was about when it was best to use the result of an 
assignment statement, not what is the traditional code structure for a 
call to "fork".

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


#136527 — Re: C idioms (Was: >< swap operator)

Fromscott@slp53.sl.home (Scott Lurndal)
Date2018-10-10 12:56 +0000
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<PFmvD.59808$un2.54146@fx14.iad>
In reply to#136509
David Brown <david.brown@hesbynett.no> writes:
>On 09/10/18 22:50, Scott Lurndal wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>> On 09/10/18 17:23, Kenny McCormack wrote:
>>>> In article <ppiei3$n9l$1@dont-email.me>,
>>>> David Brown  <david.brown@hesbynett.no> wrote:
>>>> ...
>>>>> I don't think the first version is unclear, but I don't see any...
>>>>
>>>> Because you're not a moron.  You're many things, but a moron you're not.
>>>>
>>>
>>> Why, thank you.
>>>
>>>>
>>>>> is corrected to use "if" rather than "switch").
>>>>
>>>> No.  Switch is better.
>>>>
>>>
>>> A switch is better when a switch is appropriate.  It won't work here, so
>>> it is not better.  We are branching on a value being less than, equal to
>>> or greater than zero - a switch won't do that.
>>>
>> 
>> $ grep fork */cmd/*/*.c | grep switch
>
>These do not match the original code, which tested for pid being less 
>than, equal to or greater than 0.  You can't do that with a switch.  I 
>am not particularly familiar with the details of fork() - it is not a 
>standard C call, and for all I know it could return a range of negative 
>error values.
>
>I still see no advantage of "switch" over "if" for such code - unless it 
>is viewed as such a common idiom that the familiarity is an advantage.
>
>
>However, the point here was not "what is the best way to write a call to 
>fork", but to look at where it might be useful to use the result of an 
>assignment expression, how the code code be re-structured to avoid it, 
>and whether one version is "better" than the other.
>

fork() returns three values:

  -1  (an error occurred)
   0  (You are executing as the child)
  >0  (You are executing as the parent, and the return value is the child pid).

switch is _perfect_ for this.

(as a nit, I really dislike code that tests for less than zero on
interfaces that are defined to return -1 on error - which Bart's
original example did).

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


#136535 — Re: C idioms (Was: >< swap operator)

FromDavid Brown <david.brown@hesbynett.no>
Date2018-10-10 15:55 +0200
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<ppl0d8$5b1$1@dont-email.me>
In reply to#136527
On 10/10/18 14:56, Scott Lurndal wrote:
> David Brown <david.brown@hesbynett.no> writes:
>> On 09/10/18 22:50, Scott Lurndal wrote:
>>> David Brown <david.brown@hesbynett.no> writes:
>>>> On 09/10/18 17:23, Kenny McCormack wrote:
>>>>> In article <ppiei3$n9l$1@dont-email.me>,
>>>>> David Brown  <david.brown@hesbynett.no> wrote:
>>>>> ...
>>>>>> I don't think the first version is unclear, but I don't see any...
>>>>>
>>>>> Because you're not a moron.  You're many things, but a moron you're not.
>>>>>
>>>>
>>>> Why, thank you.
>>>>
>>>>>
>>>>>> is corrected to use "if" rather than "switch").
>>>>>
>>>>> No.  Switch is better.
>>>>>
>>>>
>>>> A switch is better when a switch is appropriate.  It won't work here, so
>>>> it is not better.  We are branching on a value being less than, equal to
>>>> or greater than zero - a switch won't do that.
>>>>
>>>
>>> $ grep fork */cmd/*/*.c | grep switch
>>
>> These do not match the original code, which tested for pid being less 
>> than, equal to or greater than 0.  You can't do that with a switch.  I 
>> am not particularly familiar with the details of fork() - it is not a 
>> standard C call, and for all I know it could return a range of negative 
>> error values.
>>
>> I still see no advantage of "switch" over "if" for such code - unless it 
>> is viewed as such a common idiom that the familiarity is an advantage.
>>
>>
>> However, the point here was not "what is the best way to write a call to 
>> fork", but to look at where it might be useful to use the result of an 
>> assignment expression, how the code code be re-structured to avoid it, 
>> and whether one version is "better" than the other.
>>
> 
> fork() returns three values:
> 
>   -1  (an error occurred)
>    0  (You are executing as the child)
>   >0  (You are executing as the parent, and the return value is the child pid).
> 
> switch is _perfect_ for this.

So is "if".  (Let's assume the "if" check is for -1, rather than < 0.)

I have seen that people use "switch" in this case.  I have seen people
claim that "switch" is perfect for the job, or that it is better than
"if".  I have yet to see the slightest hint of an indication of /why/
"switch" would be better for the purpose.

IMHO, "if" is clearer.  It involves shorter source code, especially if
you have a bracketed scope for each branch/case.  It avoids any risk of
forgetting the "break".  It is likely that it gives at least as good, if
not better, object code.

What am I missing?  /Why/ do you think "switch" is better here?

> 
> (as a nit, I really dislike code that tests for less than zero on
> interfaces that are defined to return -1 on error - which Bart's
> original example did).
> 

That is fair enough.  Until someone pointed it out to me, I did not
realise that -1 was the only possible error result from fork() - I was
working purely from the original version of the code, with a total
disregard for whether the function was "fork" or "foo".

Since fork() cannot return any negative value other than -1, the
semantics of the code will be the same with a check for -1 or < 0.  But
checking for < 0 is perhaps an indication that the person writing the
code does not know exactly what fork() can return, and that's not good
when writing code that uses it.

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


#136537 — Re: C idioms (Was: >< swap operator)

FromBart <bc@freeuk.com>
Date2018-10-10 15:17 +0100
SubjectRe: C idioms (Was: >< swap operator)
Message-ID<pSnvD.25280$eN2.24344@fx07.am4>
In reply to#136535
On 10/10/2018 14:55, David Brown wrote:
> On 10/10/18 14:56, Scott Lurndal wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>> On 09/10/18 22:50, Scott Lurndal wrote:
>>>> David Brown <david.brown@hesbynett.no> writes:
>>>>> On 09/10/18 17:23, Kenny McCormack wrote:
>>>>>> In article <ppiei3$n9l$1@dont-email.me>,
>>>>>> David Brown  <david.brown@hesbynett.no> wrote:
>>>>>> ...
>>>>>>> I don't think the first version is unclear, but I don't see any...
>>>>>>
>>>>>> Because you're not a moron.  You're many things, but a moron you're not.
>>>>>>
>>>>>
>>>>> Why, thank you.
>>>>>
>>>>>>
>>>>>>> is corrected to use "if" rather than "switch").
>>>>>>
>>>>>> No.  Switch is better.
>>>>>>
>>>>>
>>>>> A switch is better when a switch is appropriate.  It won't work here, so
>>>>> it is not better.  We are branching on a value being less than, equal to
>>>>> or greater than zero - a switch won't do that.
>>>>>
>>>>
>>>> $ grep fork */cmd/*/*.c | grep switch
>>>
>>> These do not match the original code, which tested for pid being less
>>> than, equal to or greater than 0.  You can't do that with a switch.  I
>>> am not particularly familiar with the details of fork() - it is not a
>>> standard C call, and for all I know it could return a range of negative
>>> error values.
>>>
>>> I still see no advantage of "switch" over "if" for such code - unless it
>>> is viewed as such a common idiom that the familiarity is an advantage.
>>>
>>>
>>> However, the point here was not "what is the best way to write a call to
>>> fork", but to look at where it might be useful to use the result of an
>>> assignment expression, how the code code be re-structured to avoid it,
>>> and whether one version is "better" than the other.
>>>
>>
>> fork() returns three values:
>>
>>    -1  (an error occurred)
>>     0  (You are executing as the child)
>>    >0  (You are executing as the parent, and the return value is the child pid).
>>
>> switch is _perfect_ for this.
> 
> So is "if".  (Let's assume the "if" check is for -1, rather than < 0.)
> 
> I have seen that people use "switch" in this case.  I have seen people
> claim that "switch" is perfect for the job, or that it is better than
> "if".  I have yet to see the slightest hint of an indication of /why/
> "switch" would be better for the purpose.
> 
> IMHO, "if" is clearer.  It involves shorter source code, especially if
> you have a bracketed scope for each branch/case.  It avoids any risk of
> forgetting the "break".  It is likely that it gives at least as good, if
> not better, object code.
> 
> What am I missing?  /Why/ do you think "switch" is better here?

- Because the expression being tested is only evaluated once

- Because to achieve that with if/else if, you may need to create a
   dummy variable to store the result of the control expression, which
   is the compiler's job not yours

- Because if each branch is more than one statement, if/else NEEDS {...}
   (switch block are delimited by the next case)

- Because if you need more cases, scale is more easily expanded

- Because, even with the dummy variable, you have to write its name more
   than once, an extra source of errors if you were to mistype it

- Because with if/else if, you also have to write ==, <, <= etc, another
   thing that you can get wrong.

The only downside of switch, is requiring that break, which is just a 
very poor design choice in the language.

-- 
bart

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


Page 6 of 18 — ← Prev page 1 … 4 5 [6] 7 8 … 18  Next page →

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


csiph-web