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


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

A glitch regarding the usual malloc() idiom

Started byKeith Thompson <kst-u@mib.org>
First post2016-07-19 15:30 -0700
Last post2016-07-28 11:40 -0700
Articles 20 on this page of 303 — 28 participants

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


Contents

  A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-19 15:30 -0700
    Re: A glitch regarding the usual malloc() idiom Udyant Wig <udyant.wig@gmail.com> - 2016-07-20 09:51 +0530
      Re: A glitch regarding the usual malloc() idiom "Charles Richmond" <numerist@aquaporin4.com> - 2016-07-20 00:07 -0500
        Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 01:11 -0700
          Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 10:09 +0100
            Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 02:27 -0700
              Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 10:44 +0100
                Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 03:01 -0700
                  Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 11:17 +0100
                    Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 04:19 -0700
                      Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 12:29 +0100
                        Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 04:51 -0700
                          Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 13:01 +0100
                            Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 05:43 -0700
                              Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 15:48 +0100
                                Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-20 08:20 -0700
                                  Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 16:31 +0100
                                    Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-20 08:49 -0700
                                    Re: A glitch regarding the usual malloc() idiom "James R. Kuyper" <jameskuyper@verizon.net> - 2016-07-20 13:00 -0400
                                      Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 18:23 +0100
                      Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-20 14:17 +0100
                        Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 06:29 -0700
                          Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 15:51 +0100
                            Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-21 01:41 +0100
                              Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-21 02:05 +0100
                              Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 19:57 -0700
                                Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-21 10:14 +0100
                                  Re: A glitch regarding the usual malloc() idiom Rosario19 <Ros@invalid.invalid> - 2016-07-21 11:20 +0200
                                  Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-21 02:32 -0700
                                    Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-21 11:09 +0100
                                    Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-21 16:08 +0100
                                      Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-21 17:04 +0100
                                        Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-21 19:19 +0100
                                  Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-21 09:44 -0700
                          Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 09:05 -0700
                        Size augments for legacy code "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2016-07-20 07:22 -0700
              Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-20 11:10 +0100
              Re: A glitch regarding the usual malloc() idiom John Bode <jfbode1029@gmail.com> - 2016-08-04 13:07 -0700
                Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-08-04 14:02 -0700
                Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-08-04 22:14 +0100
                  Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-08-04 14:28 -0700
                  Re: A glitch regarding the usual malloc() idiom John Bode <jfbode1029@gmail.com> - 2016-08-04 15:58 -0700
                Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-08-04 23:29 -0700
                  Re: A glitch regarding the usual malloc() idiom John Bode <jfbode1029@gmail.com> - 2016-08-05 08:21 -0700
                  Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-08-05 08:38 -0700
                    Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-08-05 09:32 -0700
                      Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-08-05 10:30 -0700
                        Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-08-05 19:01 +0100
                          Re: A glitch regarding the usual malloc() idiom crisd <crisdunbar@gmail.com> - 2016-08-05 11:33 -0700
                          Re: A glitch regarding the usual malloc() idiom John Bode <jfbode1029@gmail.com> - 2016-08-05 12:01 -0700
                          Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-08-05 12:07 -0700
          Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 09:09 -0700
            Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 12:00 -0700
              Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-20 20:25 +0100
                Re: A glitch regarding the usual malloc() idiom Gareth Owen <gwowen@gmail.com> - 2016-07-20 20:38 +0100
                  Re: A glitch regarding the usual malloc() idiom Ike Naar <ike@iceland.freeshell.org> - 2016-07-20 20:03 +0000
                    Re: A glitch regarding the usual malloc() idiom Gareth Owen <gwowen@gmail.com> - 2016-07-20 22:31 +0100
                  Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 14:42 -0700
                    Re: A glitch regarding the usual malloc() idiom Gareth Owen <gwowen@gmail.com> - 2016-07-20 23:21 +0100
                Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-20 20:49 +0100
              Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 12:29 -0700
                Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 13:03 -0700
                  Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 16:55 -0700
                    Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 21:40 -0700
                      Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-21 07:16 +0100
                      Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-21 09:47 -0700
                      Re: A glitch regarding the usual malloc() idiom raltbos@xs4all.nl (Richard Bos) - 2016-07-23 09:37 +0000
                        Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-23 03:23 -0700
                          Re: A glitch regarding the usual malloc() idiom raltbos@xs4all.nl (Richard Bos) - 2016-07-23 19:47 +0000
                            Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-23 13:38 -0700
                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-23 17:53 -0400
                                Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-24 01:52 +0100
                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 11:06 -0400
                                    Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-24 16:32 +0100
                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 17:27 -0400
                                        Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-24 22:58 +0100
                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 18:19 -0400
                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-24 23:44 +0100
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 20:57 -0400
                                                Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 02:11 +0100
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 22:12 -0400
                                        Re: A glitch regarding the usual malloc() idiom Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-07-24 17:28 -0600
                                          Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 00:37 +0100
                                          Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-24 16:59 -0700
                                            Re: A glitch regarding the usual malloc() idiom Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-07-24 19:32 -0600
                                              Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 02:35 +0100
                                                Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 22:14 -0400
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 22:13 -0400
                                                Re: A glitch regarding the usual malloc() idiom Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-07-24 21:54 -0600
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 08:08 -0400
                                                    Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 13:09 +0100
                                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 08:22 -0400
                                                        Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 13:50 +0100
                                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 11:48 -0400
                                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 17:32 +0100
                                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 12:41 -0400
                                                            Re: A glitch regarding the usual malloc() idiom cross@spitfire.i.gajendra.net (Dan Cross) - 2016-07-25 16:35 +0000
                                                              Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 17:50 +0100
                                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 14:57 -0400
                                            Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-24 19:01 -0700
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 22:14 -0400
                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 20:58 -0400
                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 02:14 +0100
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 22:16 -0400
                                            Re: A glitch regarding the usual malloc() idiom Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-07-24 19:35 -0600
                                    Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-24 09:38 -0700
                                      Re: A glitch regarding the usual malloc() idiom "James R. Kuyper" <jameskuyper@verizon.net> - 2016-07-24 12:58 -0400
                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 17:28 -0400
                                        Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-24 23:01 +0100
                                          Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-24 15:13 -0700
                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 18:20 -0400
                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-24 23:46 +0100
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 20:59 -0400
                                                Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 02:21 +0100
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 22:17 -0400
                                                    Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 03:34 +0100
                                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 08:09 -0400
                                                        Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 13:21 +0100
                                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 11:50 -0400
                                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 17:38 +0100
                                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 14:59 -0400
                                                        Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-25 05:28 -0700
                                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 11:52 -0400
                                                            Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-25 08:59 -0700
                                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 12:29 -0400
                                                                Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-25 09:39 -0700
                                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 15:00 -0400
                                          Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-24 19:09 -0700
                                            Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 22:19 -0400
                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 03:31 +0100
                                              Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-24 21:20 -0700
                                                Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 08:10 -0400
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 08:12 -0400
                                            Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-27 09:09 -0700
                                              Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-27 09:57 -0700
                                                Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-28 11:15 -0700
                                                  Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-28 15:18 -0700
                                                    Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-30 11:59 -0700
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-28 21:02 -0400
                                                    Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-30 12:09 -0700
                                                      Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-31 14:07 -0700
                                                        Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-31 16:56 -0700
                                                          Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-08-01 08:57 -0700
                                              Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-27 11:41 -0700
                                                Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-28 11:25 -0700
                                        Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-24 15:28 -0700
                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 21:00 -0400
                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 02:31 +0100
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 22:21 -0400
                                            Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-24 19:38 -0700
                                              Re: A glitch regarding the usual malloc() idiom Siri Cruise <chine.bleu@yahoo.com> - 2016-07-24 20:18 -0700
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 08:15 -0400
                                                Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-25 07:31 -0700
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 11:59 -0400
                                                    Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-25 10:31 -0700
                                                      Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-25 18:57 +0100
                                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 15:04 -0400
                                          Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-24 19:14 -0700
                                            Re: A glitch regarding the usual malloc() idiom James Kuyper <jameskuyper@verizon.net> - 2016-07-24 22:49 -0400
                                              Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-24 21:12 -0700
                                            Re: A glitch regarding the usual malloc() idiom Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-07-24 21:58 -0600
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 08:19 -0400
                                                Re: A glitch regarding the usual malloc() idiom Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-07-25 08:34 -0600
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 12:01 -0400
                                                Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-25 08:32 -0700
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 12:03 -0400
                                    Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-25 00:24 +0100
                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-24 21:01 -0400
                                        Re: A glitch regarding the usual malloc() idiom Ian Collins <ian-news@hotmail.com> - 2016-07-25 17:08 +1200
                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 08:19 -0400
                                        Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-25 17:07 +0100
                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 12:36 -0400
                                            Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-25 10:34 -0700
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 15:05 -0400
                                                Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-25 12:18 -0700
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-25 16:05 -0400
                                            Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-26 01:08 +0100
                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 12:29 -0400
                                                Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-26 09:41 -0700
                                                  Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-26 10:50 -0700
                                                  Re: A glitch regarding the usual malloc() idiom Ike Naar <ike@iceland.freeshell.org> - 2016-07-26 18:09 +0000
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 14:43 -0400
                                                Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-26 20:25 +0100
                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 15:33 -0400
                                                    Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-26 21:05 +0100
                                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 16:37 -0400
                                                    Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-26 13:23 -0700
                                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 16:39 -0400
                                                        Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-26 14:07 -0700
                                                        Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-26 14:51 -0700
                                                          Re: A glitch regarding the usual malloc() idiom Öö Tiib <ootiib@hot.ee> - 2016-07-26 15:17 -0700
                                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 23:26 -0400
                                                            Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-26 20:46 -0700
                                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-27 07:52 +0100
                                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-27 08:47 -0400
                                                                Re: A glitch regarding the usual malloc() idiom David Brown <david.brown@hesbynett.no> - 2016-07-27 17:13 +0200
                                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-27 12:03 -0400
                                                                Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-27 09:57 -0700
                                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-27 16:18 -0400
                                                            Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-27 07:58 -0700
                                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-27 12:05 -0400
                                                                Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-27 17:18 +0100
                                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-27 16:20 -0400
                                                                    Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-28 07:14 +0100
                                                                      Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-28 08:59 -0700
                                                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-28 13:37 -0400
                                                                Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-27 09:42 -0700
                                                                  Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-27 16:20 -0400
                                                        Re: A glitch regarding the usual malloc() idiom jameskuyper@verizon.net - 2016-07-26 15:31 -0700
                                                          Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 23:32 -0400
                                                            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-27 07:58 +0100
                                                              Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-27 08:52 -0400
                                                      Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-27 11:21 +0100
                                                        Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-27 13:34 +0100
                                                          Re: A glitch regarding the usual malloc() idiom David Brown <david.brown@hesbynett.no> - 2016-07-27 16:31 +0200
                                                            Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-27 16:20 +0100
                                                              Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-27 23:36 +0100
                                                                Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-28 14:51 +0100
                                                                  Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-28 09:26 -0700
                                                              Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-28 10:54 -0700
                                                    Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-27 03:12 +0100
                                                      Re: A glitch regarding the usual malloc() idiom Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 23:35 -0400
                                                      Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-26 20:41 -0700
                                                        Re: A glitch regarding the usual malloc() idiom raltbos@xs4all.nl (Richard Bos) - 2016-07-27 15:04 +0000
                                                        Re: A glitch regarding the usual malloc() idiom Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-27 16:05 +0100
                                                          Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-27 08:17 -0700
                                                            Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-27 09:21 -0700
                                                              Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-27 09:37 -0700
                                                                Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-27 10:11 -0700
                                                                  Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-27 10:21 -0700
                                                                    Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-27 11:34 -0700
                                                                      Re: A glitch regarding the usual malloc() idiom luser droog <luser.droog@gmail.com> - 2016-07-27 14:46 -0700
                                                                      Re: A glitch regarding the usual malloc() idiom David Brown <david.brown@hesbynett.no> - 2016-07-27 22:29 +0200
                                                                Re: A glitch regarding the usual malloc() idiom David Brown <david.brown@hesbynett.no> - 2016-07-27 20:32 +0200
                                                                  Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-28 00:22 -0700
                                                                    Re: A glitch regarding the usual malloc() idiom David Brown <david.brown@hesbynett.no> - 2016-07-28 13:01 +0200
                                                                      Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-28 04:46 -0700
                                                  Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-26 12:57 -0700
                                                  Re: A glitch regarding the usual malloc() idiom "James R. Kuyper" <jameskuyper@verizon.net> - 2016-07-26 16:00 -0400
                                Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-24 00:08 -0700
                              Re: A glitch regarding the usual malloc() idiom raltbos@xs4all.nl (Richard Bos) - 2016-07-27 14:58 +0000
                                Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-27 09:14 -0700
                                Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-27 11:55 -0700
              Re: A glitch regarding the usual malloc() idiom Ike Naar <ike@iceland.freeshell.org> - 2016-07-20 19:47 +0000
                Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 13:09 -0700
                  Re: A glitch regarding the usual malloc() idiom Ike Naar <ike@iceland.freeshell.org> - 2016-07-20 20:49 +0000
                    Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 14:35 -0700
        Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 09:01 -0700
      Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 08:59 -0700
    Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-20 09:24 -0700
      Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 11:28 -0700
        Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-21 18:38 -0700
    Re: A glitch regarding the usual malloc() idiom Rosario19 <Ros@invalid.invalid> - 2016-07-20 22:10 +0200
    Re: A glitch regarding the usual malloc() idiom Anand Hariharan <mailto.anand.hariharan@gmail.com> - 2016-07-20 16:16 -0700
      Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-20 19:56 -0700
      Re: A glitch regarding the usual malloc() idiom Udyant Wig <udyant.wig@gmail.com> - 2016-07-21 18:46 +0530
        Re: A glitch regarding the usual malloc() idiom Ike Naar <ike@iceland.freeshell.org> - 2016-07-21 17:20 +0000
          Re: A glitch regarding the usual malloc() idiom Udyant Wig <udyant.wig@gmail.com> - 2016-07-22 18:03 +0530
        Re: A glitch regarding the usual malloc() idiom James Kuyper <jameskuyper@verizon.net> - 2016-07-21 15:39 -0400
          Re: A glitch regarding the usual malloc() idiom Udyant Wig <udyant.wig@gmail.com> - 2016-07-22 18:04 +0530
            Re: A glitch regarding the usual malloc() idiom James Kuyper <jameskuyper@verizon.net> - 2016-07-22 13:44 -0400
              Re: A glitch regarding the usual malloc() idiom Udyant Wig <udyant.wig@gmail.com> - 2016-07-23 15:38 +0530
          Re: A glitch regarding the usual malloc() idiom Udyant Wig <udyant.wig@gmail.com> - 2016-07-23 15:36 +0530
            Re: A glitch regarding the usual malloc() idiom "James R. Kuyper" <jameskuyper@verizon.net> - 2016-07-23 13:08 -0400
              Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-23 13:23 -0700
            Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-23 19:57 +0100
            Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-23 13:03 -0700
              Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-24 08:06 -0700
                Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-24 14:17 -0700
        Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-21 19:45 -0700
          Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 13:13 +0100
      Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-21 19:23 -0700
        Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-21 20:02 -0700
          Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-22 07:57 +0100
            Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-22 00:18 -0700
              Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-22 08:20 +0100
                Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-22 00:49 -0700
                  Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-22 09:31 +0100
                    Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 10:22 +0100
                      Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-22 12:21 +0100
                        Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 17:15 +0100
                          Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-23 19:46 +0100
                        Re: A glitch regarding the usual malloc() idiom supercat@casperkitty.com - 2016-07-22 16:43 -0700
                      Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-22 09:17 -0700
                        Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 18:21 +0100
                          Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-22 11:05 -0700
                            Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 22:38 +0100
                        Re: A glitch regarding the usual malloc() idiom James Kuyper <jameskuyper@verizon.net> - 2016-07-22 13:58 -0400
                          Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-22 11:14 -0700
                    Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-22 02:23 -0700
                      Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-22 12:23 +0100
                        Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-22 06:44 -0700
                          Re: A glitch regarding the usual malloc() idiom Keith Thompson <kst-u@mib.org> - 2016-07-22 09:18 -0700
                        Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 17:00 +0100
                          Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-23 19:48 +0100
            Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 10:08 +0100
              Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 10:26 +0100
              Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-22 12:12 +0100
                Re: A glitch regarding the usual malloc() idiom BartC <bc@freeuk.com> - 2016-07-22 12:35 +0100
                  Re: A glitch regarding the usual malloc() idiom Richard Heathfield <rjh@cpax.org.uk> - 2016-07-22 14:47 +0100
          Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-25 09:37 -0700
            Re: A glitch regarding the usual malloc() idiom Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-25 09:50 -0700
              Re: A glitch regarding the usual malloc() idiom Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-28 11:40 -0700

Page 15 of 16 — ← Prev page 1 … 13 14 [15] 16  Next page →


#90789

FromBartC <bc@freeuk.com>
Date2016-07-22 17:15 +0100
Message-ID<nmtgrc$mpg$1@dont-email.me>
In reply to#90771
On 22/07/2016 12:21, Richard Heathfield wrote:
> On 22/07/16 10:22, BartC wrote:

>> Plus there is a big exception to how [sizeof] works.

>> But what's the type of the expression here: sizeof "bart"?

>> And if it is char[5], then it's puzzling as to why: sizeof *"bart" is
>> allowed.
>
> No, it's not puzzling. *"bart" is equivalent to *("bart" + 0), which is
> equivalent to "bart"[0], which is equivalent to 'b'. It's not difficult.

Take this:

char s[20];
char *t;

printf("%d\n",sizeof (s));        // 20
printf("%d\n",sizeof (t));        // 8
printf("%d\n",sizeof (*s));       // 1
printf("%d\n",sizeof (*t));       // 1

s is 20 bytes; t is 8 bytes. Obviously they must be somewhat different 
types. How so then that both can be dereferenced with "*"?

>> There are a lot of inconsistencies associated with this trivial little
>> feature.
>
> You say so. I don't agree.

It's because there is another exception here, that array names don't 
decay to pointers when they are a direct sizeof operand.

With an exception to this exception when the array name is indirect, as 
in *s.


-- 
Bartc

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


#90850

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-07-23 19:46 +0100
Message-ID<nn0e20$frc$2@dont-email.me>
In reply to#90789
On 22/07/16 17:15, BartC wrote:
> On 22/07/2016 12:21, Richard Heathfield wrote:
>> On 22/07/16 10:22, BartC wrote:
>
>>> Plus there is a big exception to how [sizeof] works.
>
>>> But what's the type of the expression here: sizeof "bart"?
>
>>> And if it is char[5], then it's puzzling as to why: sizeof *"bart" is
>>> allowed.
>>
>> No, it's not puzzling. *"bart" is equivalent to *("bart" + 0), which is
>> equivalent to "bart"[0], which is equivalent to 'b'. It's not difficult.
>
> Take this:
>
> char s[20];
> char *t;
>
> printf("%d\n",sizeof (s));        // 20
> printf("%d\n",sizeof (t));        // 8
> printf("%d\n",sizeof (*s));       // 1
> printf("%d\n",sizeof (*t));       // 1
>
> s is 20 bytes; t is 8 bytes. Obviously they must be somewhat different
> types. How so then that both can be dereferenced with "*"?

s has type char [20], and t has type char *.

In a value context, they can both be dereferenced with * because array 
names, when used in a value context, are treated as pointers to their 
first elements.

You ought to have known this already. Buy a copy of K&R, and read it.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


#90827

Fromsupercat@casperkitty.com
Date2016-07-22 16:43 -0700
Message-ID<9bc81897-3640-4bac-8668-ef340e7e5ca4@googlegroups.com>
In reply to#90771
On Friday, July 22, 2016 at 6:21:46 AM UTC-5, Richard Heathfield wrote:
> Yes. In C, a byte is a unit of storage exactly wide enough to store one 
> character.

Further, a family of dialects that was very popular for programming
microcomputers in the 1990s regarded bytes as being precisely 8 bits,
allowed any pair of bytes on a 16-bit boundary to be regarded as a 16-bit
"short", or any group of four bytes on a 32-bit boundary to be regarded as
a 32-bit "long".  Although there existed non-microcomputer implementations
that behaved contrary to the above, microcomputer implementations were very
consistent, and code relying upon types that work as described would be
considered "portable" if it could accommodate big-endian or little-endian
ordering, could accommodate either 16-bit or 32-bit "int", and did not make
any particular assumptions about the size of pointers.

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


#90790

FromKeith Thompson <kst-u@mib.org>
Date2016-07-22 09:17 -0700
Message-ID<ln4m7hk5p5.fsf@kst-u.example.com>
In reply to#90762
BartC <bc@freeuk.com> writes:
> On 22/07/2016 09:31, Richard Heathfield wrote:
>> I'd pick the meaning defined by the language spec. The sizeof operator
>> yields the size in bytes of its operand. Full stop.
>
> 'bytes'?

Yes, bytes.  If you have a question about that, feel free to ask it.

> Plus there is a big exception to how it works. Normally it takes the 
> type of the nominal expression and returns size in char units that such 
> a type would occupy.
>
> But what's the type of the expression here: sizeof "bart"?

The type of `sizeof "bart"` is size_t, and the value is 5.  The type of
`"bart"` is char[5].

> If it's char*, then it gives the wrong answer (5 instead of perhaps 4 or 
> 8). If it's char[5], then this is different from most other contexts as 
> the array is treated as a value type.

If *what* is char*?

An array expression that is the operand of sizeof is not converted to a
pointer.  Every C programmer needs to know that.

> And if it is char[5], then it's puzzling as to why: sizeof *"bart" is 
> allowed.

How is it puzzling?  A string literal that's the operand of unary `*`
*is* converted to a pointer, so `*"bart"` is of type char*, and
`sizeof *"bart"` is the same as `sizeof (char*)`.

> There are a lot of inconsistencies associated with this trivial little 
> feature.

No.

-- 
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]


#90792

FromBartC <bc@freeuk.com>
Date2016-07-22 18:21 +0100
Message-ID<nmtkmc$4m9$1@dont-email.me>
In reply to#90790
On 22/07/2016 17:17, Keith Thompson wrote:
> BartC <bc@freeuk.com> writes:

>> There are a lot of inconsistencies associated with this trivial little
>> feature.
>
> No.

Here's a little list of minor issues to do with sizeof in C, and how 
they compare with the equivalent in my own language:

                                                 C     My lang

(1) Special rule about parentheses              yes   no
(2) Special treatment for array types           yes   no
(3) Can look like an operator                   yes   no
(4) Can look like a function                    yes   no
(5) sizeof * p has same shape as a * b          yes   no
(6) Special rule: expr can't start with cast    yes   no
(7) *p expression not evaluated                 yes   yes
(8) Something funny about VLAs                  yes   n.a.

(1) type operands need parentheses
(2) arrays are treated as value types unlike most other
     expressions in the language
(6) if an expression starts with a cast, that would confuse
     the parser as it would look like sizeof (T). So that isn't
     allowed.

Notice that 6 out of 7 aren't an issue in the other language.

That's why I said there are a lot of inconsistencies.

-- 
Bartc

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


#90799

FromKeith Thompson <kst-u@mib.org>
Date2016-07-22 11:05 -0700
Message-ID<lnh9bhim4b.fsf@kst-u.example.com>
In reply to#90792
BartC <bc@freeuk.com> writes:
> On 22/07/2016 17:17, Keith Thompson wrote:
>> BartC <bc@freeuk.com> writes:
>>> There are a lot of inconsistencies associated with this trivial little
>>> feature.
>>
>> No.
>
> Here's a little list of minor issues to do with sizeof in C, and how 
> they compare with the equivalent in my own language:

Ah, so you consider any special-case rule to be an "inconsistency".

Special-case rules make the description a bit more complicated than it
would otherwise be, but the description as a whole is still logically
consistent.

>                                                  C     My lang
>
> (1) Special rule about parentheses              yes   no

sizeof, like any other unary operator (quibble: it's not syntactically a
"unary-operator", but it plays a very similar role) takes an expression
as its operand.  The special rule is that the operand can also be a
parenthesized type name.

> (2) Special treatment for array types           yes   no

Yes, there's a special rule when the argument is an expression of array
type.  Similar special rules apply when an expression of array type is
the operand of unary "&" and when it's a string literal in an
initializer used to initialize an array object.

> (3) Can look like an operator                   yes   no

Yes, because it is an operator.

> (4) Can look like a function                    yes   no

Not really, because function names are never keywords -- and if the
operand is an expression and you don't add redundant parentheses, it
*doesn't* look like a function call.

Similarly, a return statement can look like a function call if you add
redundant parentheses.  An if or while statement can look look like a
function call if you use the same spacing.

> (5) sizeof * p has same shape as a * b          yes   no

Easily avoided with judicious use of whitespace.  Never write
`sizeof * p` (unless you're being deliberately obscure).

If you insist on writing `sizeof (*p)`, you're perfectly free to
do so.

> (6) Special rule: expr can't start with cast    yes   no

Needed because of the syntactic similarity of a parenthesized type name
used as a cast operator and a parenthesized type name used as the
operand of sizeof.  But why would you apply sizeof to a cast expression?
If you're specifying the type, you don't need a cast; just use the type
name by itself.  Has this *ever* been a problem for you?

If you do need to apply sizeof to a cast expression for some reason
(perhaps it's being invoked via a macro?), just add parentheses.

> (7) *p expression not evaluated                 yes   yes
> (8) Something funny about VLAs                  yes   n.a.
[...]
> That's why I said there are a lot of inconsistencies.

There are a number of special-case rules (though fewer than you claim),
but the entire set of rules, special cases included, is consistent.

-- 
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]


#90821

FromBartC <bc@freeuk.com>
Date2016-07-22 22:38 +0100
Message-ID<nmu3pf$r39$1@dont-email.me>
In reply to#90799
On 22/07/2016 19:05, Keith Thompson wrote:
> BartC <bc@freeuk.com> writes:

>> (3) Can look like an operator                   yes   no
>
> Yes, because it is an operator.

Only because the C language considers almost everything an operator that 
isn't a statement.

That includes =, (), [], (type), ?:, ->, dot and comma as well as sizeof.

While &:address-of and *:dereference are borderline to be added to that 
list of 'things-that-C-considers-operators-but-aren't-quite-really'.

(I prefer the narrower view of an operator being something that takes 
one or two operands which are both values of first-class types of the 
language, and that returns a first-class result.

Something that could, in other words, be emulated by functions (external 
and foreign if necessary if the workings need to be opaque) even if you 
lose automatic overloading that way.)

-- 
Bartc

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


#90798

FromJames Kuyper <jameskuyper@verizon.net>
Date2016-07-22 13:58 -0400
Message-ID<nmtmsj$c6b$1@dont-email.me>
In reply to#90790
On 07/22/2016 12:17 PM, Keith Thompson wrote:
> BartC <bc@freeuk.com> writes:
...
>> And if it is char[5], then it's puzzling as to why: sizeof *"bart" is 
>> allowed.
> 
> How is it puzzling?  A string literal that's the operand of unary `*`
> *is* converted to a pointer, ...

So far, so good, but ...

> ... so `*"bart"` is of type char*, and
> `sizeof *"bart"` is the same as `sizeof (char*)`.

*"bart" has a value of 'b' and a type of char. sizeof *"bart" therefore
has a value of 1.

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


#90801

FromKeith Thompson <kst-u@mib.org>
Date2016-07-22 11:14 -0700
Message-ID<lnd1m5ilpq.fsf@kst-u.example.com>
In reply to#90798
James Kuyper <jameskuyper@verizon.net> writes:
> On 07/22/2016 12:17 PM, Keith Thompson wrote:
>> BartC <bc@freeuk.com> writes:
> ...
>>> And if it is char[5], then it's puzzling as to why: sizeof *"bart" is 
>>> allowed.
>> 
>> How is it puzzling?  A string literal that's the operand of unary `*`
>> *is* converted to a pointer, ...
>
> So far, so good, but ...
>
>> ... so `*"bart"` is of type char*, and
>> `sizeof *"bart"` is the same as `sizeof (char*)`.
>
> *"bart" has a value of 'b' and a type of char. sizeof *"bart" therefore
> has a value of 1.

Quite correct, thank you.

-- 
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]


#90763

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2016-07-22 02:23 -0700
Message-ID<f4b175f3-031f-42b7-ac79-289ea013c17a@googlegroups.com>
In reply to#90758
On Friday, July 22, 2016 at 9:31:09 AM UTC+1, Richard Heathfield wrote:
> On 22/07/16 08:49, Malcolm McLean wrote:
> <snip>
> >
> > sizeof *array
> >
> > could mean
> > dereference the pointer array and take its absolute value.
> 
> No, it couldn't.
> 
> > multiply the variable array by the variable sizeof.
> 
> No, it couldn't.
> 
> > take the amount of memory occupied by a pointer to an array.
> 
> No, it couldn't.
> 
> > take the number of elements in the first row of the array.
> 
> No, it couldn't.
> 
> > take the amount of memory occupied by the first element of the array.
> 
> No, it couldn't.
> 
That's what it does mean.
Despite your familiarity with C, you've actually missed the one potential
meaning which is in fact correct.
>
> > Now why would you naturally pick one meaning rather than another?
> 
> I'd pick the meaning defined by the language spec. The sizeof operator 
> yields the size in bytes of its operand. Full stop.
> 
To a script programmer, C is that vile low-level programming language in
which horrid functions which have to be micro-efficient are written in,
by people who don't wash, don't have girlfriends, and disbelieve in software
patents.
He doesn't like going there. But sometimes he has to.

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


#90772

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-07-22 12:23 +0100
Message-ID<nmsvnm$pbk$2@dont-email.me>
In reply to#90763
On 22/07/16 10:23, Malcolm McLean wrote:
> On Friday, July 22, 2016 at 9:31:09 AM UTC+1, Richard Heathfield wrote:
>> On 22/07/16 08:49, Malcolm McLean wrote:
>> <snip>
>>>
>>> sizeof *array
>>>
>>> could mean
>>> dereference the pointer array and take its absolute value.
>>
>> No, it couldn't.
>>
>>> multiply the variable array by the variable sizeof.
>>
>> No, it couldn't.
>>
>>> take the amount of memory occupied by a pointer to an array.
>>
>> No, it couldn't.
>>
>>> take the number of elements in the first row of the array.
>>
>> No, it couldn't.
>>
>>> take the amount of memory occupied by the first element of the array.
>>
>> No, it couldn't.
>>
> That's what it does mean.

No, it doesn't.

> Despite your familiarity with C, you've actually missed the one potential
> meaning which is in fact correct.

No, I didn't. It doesn't "take" any memory at all. It /yields/ the size 
of its operand.

>>> Now why would you naturally pick one meaning rather than another?
>>
>> I'd pick the meaning defined by the language spec. The sizeof operator
>> yields the size in bytes of its operand. Full stop.
>>
> To a script programmer, C is that vile low-level programming language

If you don't like it, you have some choices:

1) learn to like it;
2) don't use it;
3) put up with not liking it;
4) moan about it constantly.

Option 4 is not attractive.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


#90781

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2016-07-22 06:44 -0700
Message-ID<6890434d-b061-4cb8-b003-5feb9a694882@googlegroups.com>
In reply to#90772
On Friday, July 22, 2016 at 12:23:42 PM UTC+1, Richard Heathfield wrote:
> On 22/07/16 10:23, Malcolm McLean wrote:
> 
> > To a script programmer, C is that vile low-level programming language
> 
> If you don't like it, you have some choices:
> 
> 1) learn to like it;
> 2) don't use it;
> 3) put up with not liking it;
> 4) moan about it constantly.
> 
> Option 4 is not attractive.
> 
Option 5

use it, but avoid those features which give it a bad name. Especially where
they don't add significant expressive power. My position is no different to
those who never use goto.

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


#90791

FromKeith Thompson <kst-u@mib.org>
Date2016-07-22 09:18 -0700
Message-ID<lnzip9ir2r.fsf@kst-u.example.com>
In reply to#90781
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Friday, July 22, 2016 at 12:23:42 PM UTC+1, Richard Heathfield wrote:
>> On 22/07/16 10:23, Malcolm McLean wrote:
>> 
>> > To a script programmer, C is that vile low-level programming language
>> 
>> If you don't like it, you have some choices:
>> 
>> 1) learn to like it;
>> 2) don't use it;
>> 3) put up with not liking it;
>> 4) moan about it constantly.
>> 
>> Option 4 is not attractive.
>> 
> Option 5
>
> use it, but avoid those features which give it a bad name. Especially where
> they don't add significant expressive power. My position is no different to
> those who never use goto.

Feel free to choose option 5.  Please stop choosing option 4 as well.

-- 
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]


#90788

FromBartC <bc@freeuk.com>
Date2016-07-22 17:00 +0100
Message-ID<nmtfuu$ji8$1@dont-email.me>
In reply to#90772
On 22/07/2016 12:23, Richard Heathfield wrote:
> On 22/07/16 10:23, Malcolm McLean wrote:

>>>> take the amount of memory occupied by the first element of the array.
>>>
>>> No, it couldn't.
>>>
>> That's what it does mean.
>
> No, it doesn't.

You don't want to be wrong do you?!

>> Despite your familiarity with C, you've actually missed the one potential
>> meaning which is in fact correct.
>
> No, I didn't. It doesn't "take" any memory at all. It /yields/ the size
> of its operand.

The array could already be allocated. The size of the element might be 
needed for a similar array, for a realloc, or for a dozen reasons.

You might have had a point if the sizeof argument was a type, but I 
think it would still have been OK to talk about the memory occupied by 
an array element that doesn't yet exist.

>> To a script programmer, C is that vile low-level programming language
>
> If you don't like it, you have some choices:

> 3) put up with not liking it;
> 4) moan about it constantly.

3) and 4) go together.

But given that such a low-level language is necessary, it is frustrating 
sometimes when you see dozens of poor decisions in its design, and 
nothing being done about it even after decades. (Compare with Fortran.)

Worse when others believe it's perfectly fine, or pretend that it is.

-- 
Bartc

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


#90851

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-07-23 19:48 +0100
Message-ID<nn0e6c$frc$3@dont-email.me>
In reply to#90788
On 22/07/16 17:00, BartC wrote:
> On 22/07/2016 12:23, Richard Heathfield wrote:
>> On 22/07/16 10:23, Malcolm McLean wrote:
>
>>>>> take the amount of memory occupied by the first element of the array.
>>>>
>>>> No, it couldn't.
>>>>
>>> That's what it does mean.
>>
>> No, it doesn't.
>
> You don't want to be wrong do you?!

I quite enjoy learning, and being wrong is a great opportunity to learn. 
But I'm not wrong in this case. Buy a copy of K&R, and read it.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


#90760

FromBartC <bc@freeuk.com>
Date2016-07-22 10:08 +0100
Message-ID<nmsnrc$uc$1@dont-email.me>
In reply to#90751
On 22/07/2016 07:57, Richard Heathfield wrote:
> On 22/07/16 04:02, Malcolm McLean wrote:
> <snip>
>>
>> Now anyone can glance at sizeof(int) and tell you what must be
>> intended. 4 bytes.
>
> No, sizeof(int) bytes must be intended. That may be 4, or it may be 1 or
> 2 or 3 or 5 or 117; but, whatever happens, it's sizeof(int) bytes.
>
>> sizeof *xarray ? xarray is an array that
>> holds integer x values in some complicated algorithm, he can
>> see that because there are lines like xarray[Nx -i] = size*j;
>
> No, all you can say about xarray from a line like that is that it is an
> array or possibly a pointer. There is no reason to conclude that it
> holds integer values.
>
>> But what does sizeof *xarray mean? It's cryptic.
>
> No, it's trivial. It means the number of bytes required to store *xarray.

Unless you have:

  #define sizeof xarray

then sizeof *xarray evaluates the square of xarray.

While using:

  #define xarray sizeof

then xarray*array means the bytes required to store *xarray (I couldn't 
quite manage xarray*xarray).

-- 
Bartc

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


#90764

FromBartC <bc@freeuk.com>
Date2016-07-22 10:26 +0100
Message-ID<nmsote$43d$1@dont-email.me>
In reply to#90760
On 22/07/2016 10:08, BartC wrote:

> then xarray*array means the bytes required to store *xarray

To store *array. (array needs to be some pointer type.)

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


#90770

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-07-22 12:12 +0100
Message-ID<nmsv36$ndk$1@dont-email.me>
In reply to#90760
On 22/07/16 10:08, BartC wrote:
> On 22/07/2016 07:57, Richard Heathfield wrote:
>> On 22/07/16 04:02, Malcolm McLean wrote:
<snip>
>>
>>> But what does sizeof *xarray mean? It's cryptic.
>>
>> No, it's trivial. It means the number of bytes required to store *xarray.
>
> Unless you have:
>
>   #define sizeof xarray

Don't be ridiculous. Please.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


#90773

FromBartC <bc@freeuk.com>
Date2016-07-22 12:35 +0100
Message-ID<nmt0es$s1i$1@dont-email.me>
In reply to#90770
On 22/07/2016 12:12, Richard Heathfield wrote:
> On 22/07/16 10:08, BartC wrote:
>> On 22/07/2016 07:57, Richard Heathfield wrote:
>>> On 22/07/16 04:02, Malcolm McLean wrote:
> <snip>
>>>
>>>> But what does sizeof *xarray mean? It's cryptic.
>>>
>>> No, it's trivial. It means the number of bytes required to store
>>> *xarray.
>>
>> Unless you have:
>>
>>   #define sizeof xarray
>
> Don't be ridiculous. Please.

Not so ridiculous:

  #define sizeof(a) trapsizeof(__LINE__)

  int trapsizeof(int line){
     printf("sizeof used on line %d\n",line);
     return 0;
  }


-- 
Bartc

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


#90783

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-07-22 14:47 +0100
Message-ID<nmt866$mc1$1@dont-email.me>
In reply to#90773
On 22/07/16 12:35, BartC wrote:
> On 22/07/2016 12:12, Richard Heathfield wrote:
>> On 22/07/16 10:08, BartC wrote:
>>> On 22/07/2016 07:57, Richard Heathfield wrote:
>>>> On 22/07/16 04:02, Malcolm McLean wrote:
>> <snip>
>>>>
>>>>> But what does sizeof *xarray mean? It's cryptic.
>>>>
>>>> No, it's trivial. It means the number of bytes required to store
>>>> *xarray.
>>>
>>> Unless you have:
>>>
>>>   #define sizeof xarray
>>
>> Don't be ridiculous. Please.
>
> Not so ridiculous:
>
>   #define sizeof(a) trapsizeof(__LINE__)

Still ridiculous. sizeof is a keyword. Don't try to redefine keywords 
using macro substitution. It's Just Plain Stupid.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


Page 15 of 16 — ← Prev page 1 … 13 14 [15] 16  Next page →

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


csiph-web