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


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

How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code?

Started byDFS <nospam@dfs.com>
First post2016-12-22 22:47 -0500
Last post2017-01-07 18:51 -0500
Articles 20 on this page of 161 — 27 participants

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


Contents

  How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2016-12-22 22:47 -0500
    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ike Naar <ike@iceland.freeshell.org> - 2016-12-23 06:56 +0000
      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 11:08 +0000
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 11:26 +0000
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 12:09 +0000
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 12:34 +0000
              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-23 12:56 -0800
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 20:58 +0000
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 21:09 +0000
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Jean-Marc Bourguet <jm@bourguet.org> - 2016-12-23 13:36 +0100
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 12:39 +0000
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-24 16:46 +1300
              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-24 13:04 +0000
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-25 09:43 +1300
                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-24 22:01 +0000
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-24 15:21 -0800
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? luser droog <luser.droog@gmail.com> - 2016-12-24 15:29 -0800
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-25 16:53 +1300
                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-25 13:13 +0000
                        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2016-12-27 09:42 -0800
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Manfred <noname@invalid.add> - 2017-02-03 20:40 +0100
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-29 13:47 -0800
                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-29 14:33 -0800
                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-01 10:04 +0000
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2017-01-01 11:38 +0000
                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-01 13:49 +0000
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-02 02:17 -0800
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? gazelle@shell.xmission.com (Kenny McCormack) - 2017-01-03 13:26 +0000
              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Robert Wessel <robertwessel2@yahoo.com> - 2016-12-26 17:29 -0600
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2016-12-27 10:10 -0800
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-28 08:33 +1300
                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2016-12-27 20:22 +0000
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-28 10:18 +1300
                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-27 13:28 -0800
                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Robert Wessel <robertwessel2@yahoo.com> - 2016-12-27 15:55 -0600
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-28 11:01 +1300
                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Robert Wessel <robertwessel2@yahoo.com> - 2016-12-27 16:40 -0600
                        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-28 11:53 +1300
                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-29 01:34 -0800
                        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2016-12-29 06:27 -0800
                          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-02 02:47 -0800
                        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-30 08:45 +1300
                          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-01 15:26 +0000
                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? asetofsymbols@gmail.com - 2017-01-01 13:03 -0800
                          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-02 03:04 -0800
                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-03 08:27 +1300
                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-02 12:37 -0800
                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-03 10:42 +1300
                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-12 21:24 -0800
                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-14 11:15 +1300
                                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-16 00:31 -0800
                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-18 21:45 +1300
                                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-30 18:24 -0800
                                        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-02-04 13:49 +1300
                                          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-10 01:57 -0800
                                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2017-02-10 10:32 +0000
                                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-13 08:44 -0800
                          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-02 10:42 -0800
                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-02 13:06 -0800
                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-03 10:53 +1300
                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 07:01 -0800
                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-03 09:01 -0800
                                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 12:36 -0800
                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-04 09:51 +1300
                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-03 13:08 -0800
                                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 14:07 -0800
                                        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-04 11:28 +1300
                                          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Melzzzzz <Melzzzzz@zzzzz.com> - 2017-01-03 22:49 +0000
                                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-04 11:53 +1300
                                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Robert Wessel <robertwessel2@yahoo.com> - 2017-01-03 18:39 -0600
                                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Melzzzzz <Melzzzzz@zzzzz.com> - 2017-01-04 00:47 +0000
                                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-04 09:49 +0000
                                                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-04 15:45 +0000
                                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? David Brown <david.brown@hesbynett.no> - 2017-01-04 20:05 +0100
                                          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 15:55 -0800
                                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-04 13:09 +1300
                                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Melzzzzz <Melzzzzz@zzzzz.com> - 2017-01-04 00:12 +0000
                                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-04 09:50 +0000
                                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-04 07:25 -0800
                                                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Melzzzzz <Melzzzzz@zzzzz.com> - 2017-01-04 15:29 +0000
                                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-04 10:29 -0800
                                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 16:34 -0800
                                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? antispam@math.uni.wroc.pl - 2017-01-07 18:59 +0000
                                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-07 15:59 -0800
                                                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? antispam@math.uni.wroc.pl - 2017-01-08 03:27 +0000
                                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-07 21:56 -0800
                                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-03 16:22 -0800
                                              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-01-04 07:05 +0000
                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-13 15:09 -0800
                                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-13 15:40 -0800
                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-13 15:56 -0800
                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-13 15:58 -0800
                                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-14 09:29 -0800
                                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-31 08:14 -0800
                                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-31 10:57 -0800
                                        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-03 08:07 -0800
                                          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-02-03 08:43 -0800
                                            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-09 08:43 -0800
                                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-18 21:46 +1300
                                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-18 09:01 -0800
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2016-12-27 14:37 -0800
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 12:33 +0000
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 17:21 +0000
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-23 13:08 -0800
              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 22:33 +0000
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-23 14:55 -0800
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-23 15:12 -0800
                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-24 01:08 +0000
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-24 04:12 +0000
                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-24 15:12 +0000
                    Re: Inadvertent trolls Noob <root@127.0.0.1> - 2016-12-24 11:34 +0100
                      Re: Inadvertent trolls BartC <bc@freeuk.com> - 2016-12-24 12:47 +0000
                        Typo or freudian slip? (Was: Inadvertent trolls) gazelle@shell.xmission.com (Kenny McCormack) - 2016-12-24 13:13 +0000
                          Re: Typo or freudian slip? (Was: Inadvertent trolls) BartC <bc@freeuk.com> - 2016-12-24 14:02 +0000
                        Re: Inadvertent trolls Keith Thompson <kst-u@mib.org> - 2016-12-24 12:36 -0800
                          Re: Inadvertent trolls Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-24 13:59 -0800
                            Re: Inadvertent trolls Gareth Owen <gwowen@gmail.com> - 2016-12-26 18:38 +0000
                        Re: C interpreter Noob <root@127.0.0.1> - 2016-12-24 23:39 +0100
                          Re: C interpreter BartC <bc@freeuk.com> - 2016-12-25 00:32 +0000
                        Re: Inadvertent trolls jacobnavia <jacob@jacob.remcomp.fr> - 2017-01-01 11:10 +0100
                          Re: Inadvertent trolls BartC <bc@freeuk.com> - 2017-01-01 11:54 +0000
    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 09:52 +0000
      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2017-01-04 23:38 -0500
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-05 17:49 +1300
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? David Brown <david.brown@hesbynett.no> - 2017-01-05 09:57 +0100
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Noob <root@127.0.0.1> - 2017-01-05 09:50 +0100
    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 11:16 +0000
    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-23 04:36 -0800
      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-23 13:24 -0800
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-29 01:35 +0000
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-01 10:06 +0000
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-28 18:33 -0800
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-02 02:13 -0800
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-02 02:53 -0800
              Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-12 23:09 -0800
                Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-13 08:51 +0000
                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-13 10:28 +0000
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-13 10:00 -0800
                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-13 10:34 -0800
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-18 21:00 +0000
                  Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-14 00:17 -0800
                    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-14 13:52 -0800
                      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-16 00:18 -0800
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-28 18:40 -0800
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-28 16:48 -0800
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-28 17:01 -0800
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-29 01:08 +0000
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-29 01:27 +0000
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-13 01:59 -0800
    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 13:01 +0000
    Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-04 14:08 -0500
      Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2017-01-05 00:05 -0500
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Norbert_Paul <norbertpauls_spambin@yahoo.com> - 2017-01-05 12:08 +0100
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2017-01-05 10:41 -0500
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Norbert_Paul <norbertpauls_spambin@yahoo.com> - 2017-01-05 18:08 +0100
            Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2017-01-05 17:08 +0000
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2017-01-05 12:02 +0000
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? James Kuyper <jameskuyper@verizon.net> - 2017-01-05 14:36 -0500
        Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? antispam@math.uni.wroc.pl - 2017-01-07 20:20 +0000
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-07 12:55 -0800
          Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2017-01-07 18:51 -0500

Page 1 of 9  [1] 2 3 4 5 6 7 8 9  Next page →


#100060 — How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code?

FromDFS <nospam@dfs.com>
Date2016-12-22 22:47 -0500
SubjectHow does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code?
Message-ID<o3i6n3$sfv$2@dont-email.me>
#include <stdio.h>
int main(void) {
   printf("%d\n",atoi("20161222"));
}


The current version of gcc is here.
http://mirrors.concertpass.com/gcc/releases/gcc-6.3.0/

Which file(s) in the compiler are responsible for converting 
atoi("20161222") into the final executable form?

Most gcc files are themselves .c and .h files.

I looked thru a bunch of files and other than a couple in the Go 
language folder, couldn't find a mention of atoi.

Thanks


[toc] | [next] | [standalone]


#100061

FromIke Naar <ike@iceland.freeshell.org>
Date2016-12-23 06:56 +0000
Message-ID<slrn3vfso5pinh.mej.ike@iceland.freeshell.org>
In reply to#100060
On 2016-12-23, DFS <nospam@dfs.com> wrote:
> #include <stdio.h>
> int main(void) {
>    printf("%d\n",atoi("20161222"));
> }
>
>
> The current version of gcc is here.
> http://mirrors.concertpass.com/gcc/releases/gcc-6.3.0/
>
> Which file(s) in the compiler are responsible for converting 
> atoi("20161222") into the final executable form?
>
> Most gcc files are themselves .c and .h files.
>
> I looked thru a bunch of files and other than a couple in the Go 
> language folder, couldn't find a mention of atoi.

The atoi function is not part of gcc,
it's part of the C runtime library (glibc, if you use GNU).

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


#100063

FromBartC <bc@freeuk.com>
Date2016-12-23 11:08 +0000
Message-ID<o3j0gm$3ts$1@dont-email.me>
In reply to#100061
On 23/12/2016 06:56, Ike Naar wrote:
> On 2016-12-23, DFS <nospam@dfs.com> wrote:
>> #include <stdio.h>
>> int main(void) {
>>    printf("%d\n",atoi("20161222"));
>> }
>>
>>
>> The current version of gcc is here.
>> http://mirrors.concertpass.com/gcc/releases/gcc-6.3.0/
>>
>> Which file(s) in the compiler are responsible for converting
>> atoi("20161222") into the final executable form?
>>
>> Most gcc files are themselves .c and .h files.
>>
>> I looked thru a bunch of files and other than a couple in the Go
>> language folder, couldn't find a mention of atoi.
>
> The atoi function is not part of gcc,
> it's part of the C runtime library (glibc, if you use GNU).
>

I've got a directory which appears to be the source code for gcc, or a 
version of it.

Do you mean that, despite the 52,000 .c and .h files, it still doesn't 
include sources for the C libraries?

I think it would be quicker to just write an atoi() function rather than 
try and find the source online!

-- 
Bartc

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


#100065

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-12-23 11:26 +0000
Message-ID<o3j1j5$7k8$1@dont-email.me>
In reply to#100063
On 23/12/16 11:08, BartC wrote:
> On 23/12/2016 06:56, Ike Naar wrote:

<snip>

>> The atoi function is not part of gcc,
>> it's part of the C runtime library (glibc, if you use GNU).
>>
>
> I've got a directory which appears to be the source code for gcc, or a
> version of it.
>
> Do you mean that, despite the 52,000 .c and .h files, it still doesn't
> include sources for the C libraries?

Yes, he means that the source code for one program doesn't appear within 
the source code for another program. So what? Do you include all the 
source for all your programs within all your other programs?

> I think it would be quicker to just write an atoi() function rather than
> try and find the source online!

Why do you think he wants to find the source for atoi? I can think of 
three possible reasons:

1. He wants to study the source in an attempt to learn how one might go 
about writing an atoi function, in which case the advice to "write your 
own", despite having a certain merit, is likely to make him throw up his 
hands in frustration at your intransigence;

2. he wants to study the source in order to see precisely how the 
specific implementation handles the task of converting a string 
representation of a number into the number itself, in which case "write 
your own" completely misses the point;

3. he wants to modify the source in some way (perhaps to add an error 
detection mechanism), in which case "write your own", while again being 
perhaps a better solution, is again more likely to frustrate him than to 
educate him.

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


#100067

FromBartC <bc@freeuk.com>
Date2016-12-23 12:09 +0000
Message-ID<o3j434$g4g$1@dont-email.me>
In reply to#100065
On 23/12/2016 11:26, Richard Heathfield wrote:
> On 23/12/16 11:08, BartC wrote:
>> On 23/12/2016 06:56, Ike Naar wrote:
>
> <snip>
>
>>> The atoi function is not part of gcc,
>>> it's part of the C runtime library (glibc, if you use GNU).
>>>
>>
>> I've got a directory which appears to be the source code for gcc, or a
>> version of it.
>>
>> Do you mean that, despite the 52,000 .c and .h files, it still doesn't
>> include sources for the C libraries?
>
> Yes, he means that the source code for one program doesn't appear within
> the source code for another program. So what? Do you include all the
> source for all your programs within all your other programs?

If my program was a language implementation and this was a part of the 
standard library for the language, then yes I would (and have done).

I wouldn't if such a function was clearly part of an external library or 
part of the OS.

In this case, atoi() is mentioned in the C standard, it's declared in 
the standard headers (stdlib.h) and it's mentioned in multiple places in 
K&R.

I don't know what else is needed to show that atoi() is an integral part 
of the language.

> I think it would be quicker to just write an atoi() function rather than
>> try and find the source online!
>
> Why do you think he wants to find the source for atoi?

Actually there is an implementation of it on page 43 of K&R2. All 8 
lines of it.

You'd think gcc would have a bundled /a/ version of the standard 
libraries just to get started with. And the standard headers because 
apparently these are not part of a C compiler either! It wouldn't make a 
dent in the size of the distribution (some 0.6GB).

Otherwise you'd go to all the trouble of building this massive great 
compiler and not being able to compile the Hello, World example on page 
6 of K&R2.

(Well, unless you made use of the C implementation you needed to build 
gcc. But you might take the newly-created gcc executables, and ship them 
to someone else who's got a copy of K&R and keen to get started on the 
exercises. And who's going to be disappointed.)

-- 
Bartc

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


#100069

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-12-23 12:34 +0000
Message-ID<o3j5ia$l66$1@dont-email.me>
In reply to#100067
On 23/12/16 12:09, BartC wrote:
> On 23/12/2016 11:26, Richard Heathfield wrote:
>> On 23/12/16 11:08, BartC wrote:
>>> On 23/12/2016 06:56, Ike Naar wrote:
>>
>> <snip>
>>
>>>> The atoi function is not part of gcc,
>>>> it's part of the C runtime library (glibc, if you use GNU).
>>>>
>>>
>>> I've got a directory which appears to be the source code for gcc, or a
>>> version of it.
>>>
>>> Do you mean that, despite the 52,000 .c and .h files, it still doesn't
>>> include sources for the C libraries?
>>
>> Yes, he means that the source code for one program doesn't appear within
>> the source code for another program. So what? Do you include all the
>> source for all your programs within all your other programs?
>
> If my program was a language implementation and this was a part of the
> standard library for the language, then yes I would (and have done).

I don't think you mean what you're saying here. You are saying "yes" to 
the question "do you include all the source for all your programs within 
all your other programs?" but I think you mean you consider the language 
implementation and the library implementation to be one and the same. 
Fine, that's a perfectly valid point of view, but not the /only/ valid 
point of view. The GNU folks have a different take on it, and consider 
the language implementation and the library implementation to be 
separate projects.

> I wouldn't if such a function was clearly part of an external library or
> part of the OS.

The GNU people consider the standard library to be an external library 
(or, rather, two external libraries!).

> In this case, atoi() is mentioned in the C standard, it's declared in
> the standard headers (stdlib.h) and it's mentioned in multiple places in
> K&R.

Indeed. It is, in fact, part of the standard library, which in the GNU 
implementation is separate from the compiler etc.

> I don't know what else is needed to show that atoi() is an integral part
> of the language.

Of course it is (although, arguably, it shouldn't be). But the C 
Standard only requires that the function must be available for hosted 
implementations --- it doesn't say in what way it must be made available.

>> I think it would be quicker to just write an atoi() function rather than
>>> try and find the source online!
>>
>> Why do you think he wants to find the source for atoi?
>
> Actually there is an implementation of it on page 43 of K&R2. All 8
> lines of it.

Have you tested it? It doesn't work very well.

> You'd think gcc would have a bundled /a/ version of the standard
> libraries just to get started with.

If you want the GNU people to change their policy, I suggest you contact 
them directly. This newsgroup can't change their minds for you. In the 
meantime, if you ask your OS to install gcc for you, it will typically 
install glibc as well, so it really isn't a problem for anyone except you.

<snip>

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


#100090

FromKeith Thompson <kst-u@mib.org>
Date2016-12-23 12:56 -0800
Message-ID<lnvauabbzf.fsf@kst-u.example.com>
In reply to#100069
Richard Heathfield <rjh@cpax.org.uk> writes:
[...]
> If you want the GNU people to change their policy, I suggest you contact 
> them directly. This newsgroup can't change their minds for you. In the 
> meantime, if you ask your OS to install gcc for you, it will typically 
> install glibc as well, so it really isn't a problem for anyone except you.

That depends on the OS.

Most Linux distributions come with gcc and glibc preinstalled.  As new
versions become available, they can generally be updated independently.

MacOS uses a different library implementation; I don't know whether
you can install glibc or not.  It also has transitioned from gcc
to clang by default, but you can still install gcc.  And both gcc
and clang use the same library implementation.

And Windows doesn't have a way to "ask your OS" to install gcc; you
have to find a third-party installation package, which is likely to
include both a compiler and a library (probably not glibc).  (Yes,
installing a working non-Microsoft C implementation on Windows is
more difficult than it should be.)

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


#100091

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-12-23 20:58 +0000
Message-ID<o3k32p$31q$1@dont-email.me>
In reply to#100090
On 23/12/16 20:56, Keith Thompson wrote:
> Richard Heathfield <rjh@cpax.org.uk> writes:
> [...]
>> If you want the GNU people to change their policy, I suggest you contact
>> them directly. This newsgroup can't change their minds for you. In the
>> meantime, if you ask your OS to install gcc for you, it will typically
>> install glibc as well, so it really isn't a problem for anyone except you.
>
> That depends on the OS.
>
> Most Linux distributions come with gcc and glibc preinstalled.  As new
> versions become available, they can generally be updated independently.

Yes, that's right.

> MacOS uses a different library implementation; I don't know whether
> you can install glibc or not.  It also has transitioned from gcc
> to clang by default, but you can still install gcc.  And both gcc
> and clang use the same library implementation.

I don't actually have a Mac, so I'll have to take your word for it.

> And Windows doesn't have a way to "ask your OS" to install gcc;

I'm sorry --- I thought I said "OS", not "shop window". :-)

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


#100093

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-12-23 21:09 +0000
Message-ID<o3k3o6$5it$1@dont-email.me>
In reply to#100090
On 23/12/16 20:56, Keith Thompson wrote:
> Richard Heathfield <rjh@cpax.org.uk> writes:
> [...]
>> If you want the GNU people to change their policy, I suggest you contact
>> them directly. This newsgroup can't change their minds for you. In the
>> meantime, if you ask your OS to install gcc for you, it will typically
>> install glibc as well, so it really isn't a problem for anyone except you.
>
> That depends on the OS.

Actually, I should explain why I worded it like that. (I take your point 
about the details, of course.)

What I meant was that, if you go poking around for the gcc source and 
begin a world of pain with configure, make, etc, then obviously you're 
/not/ going to get glibc as part of that process. The distinction I was 
trying to draw was that between automated install and manual install.

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


#100070

FromJean-Marc Bourguet <jm@bourguet.org>
Date2016-12-23 13:36 +0100
Message-ID<87inqahlfp.fsf@news.bourguet.org>
In reply to#100067
BartC <bc@freeuk.com> writes:

> If my program was a language implementation and this was a part of the
> standard library for the language, then yes I would (and have done).

Well, gcc is part of a wider project which has an implementation of the
standard C library (and more, it targets even more than the whole Posix
library) as another subproject.  That they bundle those two projects
together or not is just a matter of organization.

Considering that one of their target is Unix system which have a standard C
library tightly coupled with their system library (in fact the standard C
library started as part of the system independent part of that library,
with explain some misdesigns like strncpy which was not aiming to be a
general purpose string manipulation function), it makes sense to separate
both.

I think they dropped the goal for their library implementation to be usable
on other systems than Linux some time ago but I've used it on SunOS or on
Solaris at the time when the Sun provided library was not POSIX enough for
my purpose, with the Sun compiler.  So that separation make even more sense
at the time.

One of the place where gcc is used is in embedded world, it makes even more
sense to separate both.  So much that there is at least one other standard
C library designed for the embedded world (it's not part of the GNU
project, but it is provided by a company who is working on GCC).

And BTW gcc provides and has always provided the part of the standard C
library which are more tighlty coupled with the compiler.

And GCC provides the standard library for other languages bundled with the
compiler.  So it is not that they are really adverse to providing the
library part.  It really looks like the choice was driven by consideration
about their users convenience.

Yours,

-- 
Jean-Marc

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


#100072

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-12-23 12:39 +0000
Message-ID<87r34ybz0c.fsf@bsb.me.uk>
In reply to#100067
BartC <bc@freeuk.com> writes:

> On 23/12/2016 11:26, Richard Heathfield wrote:
>> On 23/12/16 11:08, BartC wrote:
>>> On 23/12/2016 06:56, Ike Naar wrote:
>>
>> <snip>
>>
>>>> The atoi function is not part of gcc,
>>>> it's part of the C runtime library (glibc, if you use GNU).
>>>>
>>>
>>> I've got a directory which appears to be the source code for gcc, or a
>>> version of it.
>>>
>>> Do you mean that, despite the 52,000 .c and .h files, it still doesn't
>>> include sources for the C libraries?
>>
>> Yes, he means that the source code for one program doesn't appear within
>> the source code for another program. So what? Do you include all the
>> source for all your programs within all your other programs?
>
> If my program was a language implementation and this was a part of the
> standard library for the language, then yes I would (and have done).

But if your compiler were meant to be able to use the host's native C
runtime (even if only as a option) you would be wise to keep them
separate.

> I wouldn't if such a function was clearly part of an external library
> or part of the OS.
>
> In this case, atoi() is mentioned in the C standard, it's declared in
> the standard headers (stdlib.h) and it's mentioned in multiple places
> in K&R.
>
> I don't know what else is needed to show that atoi() is an integral
> part of the language.

You don't need anything else.  It is part of the language in every sense
that matters.  The bit you are missing is that some programmers like to
to be able to choose the details of the language implementation so C
compilers rarely force you to use one and only one C library.

<snip>
-- 
Ben.

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


#100106

FromIan Collins <ian-news@hotmail.com>
Date2016-12-24 16:46 +1300
Message-ID<ec69epFh4irU1@mid.individual.net>
In reply to#100067
On 12/24/16 01:09 AM, BartC wrote:
> On 23/12/2016 11:26, Richard Heathfield wrote:
>> On 23/12/16 11:08, BartC wrote:
>>> On 23/12/2016 06:56, Ike Naar wrote:
>>
>> <snip>
>>
>>>> The atoi function is not part of gcc,
>>>> it's part of the C runtime library (glibc, if you use GNU).
>>>>
>>>
>>> I've got a directory which appears to be the source code for gcc, or a
>>> version of it.
>>>
>>> Do you mean that, despite the 52,000 .c and .h files, it still doesn't
>>> include sources for the C libraries?
>>
>> Yes, he means that the source code for one program doesn't appear within
>> the source code for another program. So what? Do you include all the
>> source for all your programs within all your other programs?
>
> If my program was a language implementation and this was a part of the
> standard library for the language, then yes I would (and have done).
>
> I wouldn't if such a function was clearly part of an external library or
> part of the OS.
>
> In this case, atoi() is mentioned in the C standard, it's declared in
> the standard headers (stdlib.h) and it's mentioned in multiple places in
> K&R.
>
> I don't know what else is needed to show that atoi() is an integral part
> of the language.

Unix systems have always had their own standard library implementations.

Who is better qualified to write the code that interfaces with and must 
be aware of the behaviour of the OS, the OS writers, or compiler writers?

-- 
Ian

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


#100134

FromBartC <bc@freeuk.com>
Date2016-12-24 13:04 +0000
Message-ID<o3lrmr$stq$1@dont-email.me>
In reply to#100106
On 24/12/2016 03:46, Ian Collins wrote:
> On 12/24/16 01:09 AM, BartC wrote:

>> I don't know what else is needed to show that atoi() is an integral part
>> of the language.
>
> Unix systems have always had their own standard library implementations.

Of what? The C library?

If so, do they have standard library implementations for Cobol, Lisp and 
K too? Do they have matrix-multiplication routines for maths languages?

I think there is too much cosiness between C and Unix, such that you 
can't tell what is part of the language and what is part of the OS. That 
can make things confusing.

> Who is better qualified to write the code that interfaces with and must
> be aware of the behaviour of the OS, the OS writers, or compiler writers?

In the case of a simple version of atoi(), you would expect this to be 
part of a library specific to a language.

(Anyone wanting to understand how this stuff works would be better off I 
think looking at Windows rather than Unix. Then the demarcations become 
clearer. fopen() doesn't exist in the Windows API and presumably has to 
be implemented on top of OpenFile.)

-- 
Bartc

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


#100197

FromIan Collins <ian-news@hotmail.com>
Date2016-12-25 09:43 +1300
Message-ID<ec84uqFmpfvU2@mid.individual.net>
In reply to#100134
On 12/25/16 02:04 AM, BartC wrote:
> On 24/12/2016 03:46, Ian Collins wrote:
>> On 12/24/16 01:09 AM, BartC wrote:
>
>>> I don't know what else is needed to show that atoi() is an integral part
>>> of the language.
>>
>> Unix systems have always had their own standard library implementations.
>
> Of what? The C library?

Isn't that what I wrote?

> If so, do they have standard library implementations for Cobol, Lisp and
> K too? Do they have matrix-multiplication routines for maths languages?

Why should they?  C is the interface language for the OS.

> I think there is too much cosiness between C and Unix, such that you
> can't tell what is part of the language and what is part of the OS. That
> can make things confusing.

Not really, the two grew up together and that's the way it has always 
been.  You have to have an interface between the OS and user code and 
the C standard library forms part of the interface.  Choosing to write 
your own interface and then implement a C library on top of that is a 
pointless duplication of work.

>> Who is better qualified to write the code that interfaces with and must
>> be aware of the behaviour of the OS, the OS writers, or compiler writers?
>
> In the case of a simple version of atoi(), you would expect this to be
> part of a library specific to a language.

atoi() is part of the standard library, are you advocating breaking it 
up into simple bits and harder bits?  Where would you draw the line?

-- 
Ian

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


#100199

FromBartC <bc@freeuk.com>
Date2016-12-24 22:01 +0000
Message-ID<o3mr57$6em$1@dont-email.me>
In reply to#100197
On 24/12/2016 20:43, Ian Collins wrote:
> On 12/25/16 02:04 AM, BartC wrote:
>> On 24/12/2016 03:46, Ian Collins wrote:
>>> On 12/24/16 01:09 AM, BartC wrote:
>>
>>>> I don't know what else is needed to show that atoi() is an integral
>>>> part
>>>> of the language.
>>>
>>> Unix systems have always had their own standard library implementations.
>>
>> Of what? The C library?
>
> Isn't that what I wrote?
>
>> If so, do they have standard library implementations for Cobol, Lisp and
>> K too? Do they have matrix-multiplication routines for maths languages?
>
> Why should they?  C is the interface language for the OS.

It's the interface language for Windows too (or Win16 and early Win32; 
now they call the same interface a C++ one).

But there the API is clearly not the C library. Win API functions must 
be accessed via cross-language and cross-compiler DLL files; you can't 
choose to statically link them into your program.

It's clear what is part of the language and what isn't. And that the Win 
API won't work under Unix.

>> I think there is too much cosiness between C and Unix, such that you
>> can't tell what is part of the language and what is part of the OS. That
>> can make things confusing.
>
> Not really, the two grew up together and that's the way it has always
> been.  You have to have an interface between the OS and user code and
> the C standard library forms part of the interface.

So where exactly is the line drawn between your C code, the C library, 
and the OS? It's C as far as you can see!

I think those of us having to deal with two platforms (Unix and 
Windows), having to use other languages to implement low level programs 
(and having to implement such languages) coulld well have a broader 
perspective on all this stuff.

>> In the case of a simple version of atoi(), you would expect this to be
>> part of a library specific to a language.

> atoi() is part of the standard library, are you advocating breaking it
> up into simple bits and harder bits?  Where would you draw the line?

No just the simple part. At what point did it acquire all the stuff to 
do with locales and wide characters? (Which doesn't even work: 
atoi("456,789") just gives me 456. atoi() really ought to be 
straightforward and not overambitious.)

-- 
Bartc

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


#100203

FromKeith Thompson <kst-u@mib.org>
Date2016-12-24 15:21 -0800
Message-ID<lnpokgap6d.fsf@kst-u.example.com>
In reply to#100199
BartC <bc@freeuk.com> writes:
[...]
> So where exactly is the line drawn between your C code, the C library, 
> and the OS? It's C as far as you can see!

Section 6 of the C standard defines the core language.  Section 7
defines the standard C library.  The OS is defined by whatever
documentation accompanies it.

Since the answer to your question is so simple and straightforward,
I suspect I've missed your point.  Could you clarify?

Note that the Unix/POSIX I/O functions are things like open, close,
read, and write.  The C standard I/O function fopen, fclose, fread,
fwrite et al are typically implemented on top of them (or on top
of other primitives for non-POSIX systems).

[...]

> No just the simple part. At what point did it acquire all the stuff to 
> do with locales and wide characters? (Which doesn't even work: 
> atoi("456,789") just gives me 456. atoi() really ought to be 
> straightforward and not overambitious.)

The standard says that atoi() is equivalent to strtol(), except for the
lack of error checking.  It doesn't say a whole lot about locales:

    In other than the "C" locale, additional locale-specific subject
    sequence forms may be accepted.

and I've never looked into it.  But atoi() is frankly a lousy little
function that's in the standard only for historical reasons; it
shouldn't be used except in toy programs.  (It works fine if and only if
you *know* that the argument string is valid.)

I think you're saying that atoi() should be implemented along
with the compiler rather than as part of a (possibly separately
distributed) C library.  What would be the advantage?  Currently,
as long as I have a working C implementation, I can write code
that calls atoi() and expect it to work as specified; what more do
you want?  Do you think that the reorganization you propose would
make it easier to set up a C implementation?  Do you want the entire
C standard library to be provided as part of the compiler package,
or just the "simple" parts?

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


#100205

Fromluser droog <luser.droog@gmail.com>
Date2016-12-24 15:29 -0800
Message-ID<4d685d62-a221-4d20-9315-10e47e42524e@googlegroups.com>
In reply to#100199
On Saturday, December 24, 2016 at 4:01:45 PM UTC-6, Bart wrote:

> No just the simple part. At what point did it acquire all the stuff to 
> do with locales and wide characters? (Which doesn't even work: 
> atoi("456,789") just gives me 456. atoi() really ought to be 
> straightforward and not overambitious.)
> 

Locales were added by the ISO for the first international
standard. A very good source for this info is P.J.Plauger
/The Standard C Library/.

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


#100221

FromIan Collins <ian-news@hotmail.com>
Date2016-12-25 16:53 +1300
Message-ID<ec8u5fFmpfvU4@mid.individual.net>
In reply to#100199
On 12/25/16 11:01 AM, BartC wrote:
> On 24/12/2016 20:43, Ian Collins wrote:
>> On 12/25/16 02:04 AM, BartC wrote:
>>> On 24/12/2016 03:46, Ian Collins wrote:
>>>> On 12/24/16 01:09 AM, BartC wrote:
>>>
>>>>> I don't know what else is needed to show that atoi() is an integral
>>>>> part
>>>>> of the language.
>>>>
>>>> Unix systems have always had their own standard library implementations.
>>>
>>> Of what? The C library?
>>
>> Isn't that what I wrote?
>>
>>> If so, do they have standard library implementations for Cobol, Lisp and
>>> K too? Do they have matrix-multiplication routines for maths languages?
>>
>> Why should they?  C is the interface language for the OS.
>
> It's the interface language for Windows too (or Win16 and early Win32;
> now they call the same interface a C++ one).
>
> But there the API is clearly not the C library. Win API functions must
> be accessed via cross-language and cross-compiler DLL files; you can't
> choose to statically link them into your program.

The Windows developers decided to ignore what was already there and 
developers have paid the price ever since.

> It's clear what is part of the language and what isn't. And that the Win
> API won't work under Unix.
>
>>> I think there is too much cosiness between C and Unix, such that you
>>> can't tell what is part of the language and what is part of the OS. That
>>> can make things confusing.
>>
>> Not really, the two grew up together and that's the way it has always
>> been.  You have to have an interface between the OS and user code and
>> the C standard library forms part of the interface.
>
> So where exactly is the line drawn between your C code, the C library,
> and the OS? It's C as far as you can see!

It's what is defined by the C standard and in the Unix world, POSIX.

> I think those of us having to deal with two platforms (Unix and
> Windows), having to use other languages to implement low level programs
> (and having to implement such languages) coulld well have a broader
> perspective on all this stuff.

Some of us have to deal with multiple platforms an languages, so our 
perspective is quite broad.

>>> In the case of a simple version of atoi(), you would expect this to be
>>> part of a library specific to a language.
>
>> atoi() is part of the standard library, are you advocating breaking it
>> up into simple bits and harder bits?  Where would you draw the line?
>
> No just the simple part.

As I asked, Where would you draw the line?

-- 
Ian

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


#100245

FromBartC <bc@freeuk.com>
Date2016-12-25 13:13 +0000
Message-ID<o3ogk5$eja$1@dont-email.me>
In reply to#100221
On 25/12/2016 03:53, Ian Collins wrote:
> On 12/25/16 11:01 AM, BartC wrote:

>> But there the API is clearly not the C library. Win API functions must
>> be accessed via cross-language and cross-compiler DLL files; you can't
>> choose to statically link them into your program.
>
> The Windows developers decided to ignore what was already there and
> developers have paid the price ever since.

In what way?

IC:
>>> atoi() is part of the standard library, are you advocating breaking it
>>> up into simple bits and harder bits?  Where would you draw the line?
>>
>> No just the simple part.
>
> As I asked, Where would you draw the line?

I wouldn't associate any atoi-like function with the OS at all. 
Especially not a version associated with a low-level language that is 
not expected to be sophisticated.

(Which is also dangerous if you silently allow "," or "." thousands 
separators, when the user expects to type "," to separate items and "." 
as decimal point, even in a locale where decimal points are supposed to 
be thousands separators.)

I found another version of strtol.c, this one has this comment:

  * Ignores `locale' stuff.  Assumes that the upper and lower case
  * alphabets and digits are each contiguous.

This is more like it! And the code is massively easier to understand.

(https://github.com/gcc-mirror/gcc/blob/master/libiberty/strtol.c)

Converting text to numbers can be considered at various levels:

1 The text is from an internal source, and could be in any base (but you 
wouldn't expect a base prefix such as "0x" to appear).

2 The text comes from user input, so might have extra white space, might 
need extra validation, and will most likely be in decimal. But 
separators are still unlikely.

3 More sophisticated user input that may take account of locale

I think that atoi() ought to be at level 1 or perhaps 2, while level 3 
is the responsibility of the application or of a much higher level 
library. (Which can interrogate the OS for locale info and use that to 
modify text conversion. It doesn't want a lowly function buried in the C 
runtime - and the app might not even be written directly in C - taking 
on the responsibility.)

-- 
Bartc

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


#100337

Fromsupercat@casperkitty.com
Date2016-12-27 09:42 -0800
Message-ID<fb4359c0-d2d7-4b3d-957b-7402629274e3@googlegroups.com>
In reply to#100245
On Sunday, December 25, 2016 at 7:14:14 AM UTC-6, Bart wrote:
> I wouldn't associate any atoi-like function with the OS at all. 
> Especially not a version associated with a low-level language that is 
> not expected to be sophisticated.

For functions whose behavior is defined in absolute terms as parsing a
sequence of characters in the range '0'-'9', possibly preceded by a '-',
support should probably be in the language rather than the OS.  For a
function which is supposed to support locale-specific variations (e.g.
using something other than a leading '-' to indicate negative numbers)
support does not belong in the language, but probably belongs in the OS.

Such functions might not be suitable for use when processing numbers that
users might want to type in their preferred human-readable format, but
a lot of the data that programs read and write was written and will be read
by other programs, and conventions for how computers represent numbers when
exchanging data with other computers are well established even if different
formats would be used for numbers which are to be read or entered by humans.

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


Page 1 of 9  [1] 2 3 4 5 6 7 8 9  Next page →

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


csiph-web