Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #100060 > unrolled thread
| Started by | DFS <nospam@dfs.com> |
|---|---|
| First post | 2016-12-22 22:47 -0500 |
| Last post | 2017-01-07 18:51 -0500 |
| Articles | 20 on this page of 161 — 27 participants |
Back to article view | Back to comp.lang.c
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 7 of 9 — ← Prev page 1 2 3 4 5 6 [7] 8 9 Next page →
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2017-01-01 11:54 +0000 |
| Subject | Re: Inadvertent trolls |
| Message-ID | <o4aqij$qhf$1@dont-email.me> |
| In reply to | #100757 |
On 01/01/2017 10:10, jacobnavia wrote: > Le 24/12/2016 à 13:47, BartC a écrit : >> Anyway next year I might have a go at doing a C compiler, then I can >> bore everyone showing them how /that/ should be done! >> >> >> (But why wait? Here are some early thoughts: >> https:...) >> >> > > I have done exactly that some 4-5 years ago. Source code available (at a > price). My code has to be my own as it is more interesting (and challenging) to see what /I/ can do. (Or what I can't do, as the case may be! Besides it's not written directly in C.) -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-23 09:52 +0000 |
| Message-ID | <o3is1m$l15$1@dont-email.me> |
| In reply to | #100060 |
On 23/12/16 03:47, DFS wrote:
> #include <stdio.h>
> int main(void) {
> printf("%d\n",atoi("20161222"));
> }
Ike Naar has answered your question, so I'll just add some diagnostics:
1) you have no declaration in scope for atoi. You should add:
#include <stdlib.h>
2) you fall off the end of main without returning a value. This is
explicitly given a meaning in C99 and later (main returns 0), but in C90
it means the return status is undefined.
3) INT_MAX is not required to exceed 32767; if it is lower than
20161222, the behaviour of your program is undefined. Your documentation
will tell you what INT_MAX is for your implementation. Alternatively,
you can run the following program:
#include <stdio.h>
#include <limits.h>
int main(void)
{
printf("INT_MAX = %d\n", INT_MAX);
return 0;
}
--
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]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2017-01-04 23:38 -0500 |
| Message-ID | <o4kigg$af5$1@dont-email.me> |
| In reply to | #100062 |
On 12/23/2016 4:52 AM, Richard Heathfield wrote:
> On 23/12/16 03:47, DFS wrote:
>> #include <stdio.h>
>> int main(void) {
>> printf("%d\n",atoi("20161222"));
>> }
>
> Ike Naar has answered your question,
I'm still wondering what parts of the gcc compiler translate source code
into assembly and/or executable machine code.
I mentioned gcc because its source code is available - if you know where
to look, could you point out the exact gcc files that translate C source
code into assembly and machine code?
> so I'll just add some diagnostics:
>
> 1) you have no declaration in scope for atoi. You should add:
>
> #include <stdlib.h>
>
> 2) you fall off the end of main without returning a value. This is
> explicitly given a meaning in C99 and later (main returns 0), but in C90
> it means the return status is undefined.
>
> 3) INT_MAX is not required to exceed 32767; if it is lower than
> 20161222, the behaviour of your program is undefined. Your documentation
> will tell you what INT_MAX is for your implementation. Alternatively,
> you can run the following program:
>
> #include <stdio.h>
> #include <limits.h>
>
> int main(void)
> {
> printf("INT_MAX = %d\n", INT_MAX);
> return 0;
> }
Thanks for the tips.
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2017-01-05 17:49 +1300 |
| Message-ID | <ed61jjF11foU5@mid.individual.net> |
| In reply to | #101154 |
On 01/ 5/17 05:38 PM, DFS wrote:
> On 12/23/2016 4:52 AM, Richard Heathfield wrote:
>> On 23/12/16 03:47, DFS wrote:
>>> #include <stdio.h>
>>> int main(void) {
>>> printf("%d\n",atoi("20161222"));
>>> }
>>
>> Ike Naar has answered your question,
>
>
> I'm still wondering what parts of the gcc compiler translate source code
> into assembly and/or executable machine code.
>
> I mentioned gcc because its source code is available - if you know where
> to look, could you point out the exact gcc files that translate C source
> code into assembly and machine code?
My understanding is gcc (being a Compiler Collection) translates source
code into an intermediate form which eventually gets translated to
assembly. So you wont find what you are looking for.
You might have more luck with something less all encompassing such as TC.
--
Ian
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2017-01-05 09:57 +0100 |
| Message-ID | <o4l1n5$gip$1@dont-email.me> |
| In reply to | #101155 |
On 05/01/17 05:49, Ian Collins wrote:
> On 01/ 5/17 05:38 PM, DFS wrote:
>> On 12/23/2016 4:52 AM, Richard Heathfield wrote:
>>> On 23/12/16 03:47, DFS wrote:
>>>> #include <stdio.h>
>>>> int main(void) {
>>>> printf("%d\n",atoi("20161222"));
>>>> }
>>>
>>> Ike Naar has answered your question,
>>
>>
>> I'm still wondering what parts of the gcc compiler translate source code
>> into assembly and/or executable machine code.
>>
>> I mentioned gcc because its source code is available - if you know where
>> to look, could you point out the exact gcc files that translate C source
>> code into assembly and machine code?
>
> My understanding is gcc (being a Compiler Collection) translates source
> code into an intermediate form which eventually gets translated to
> assembly. So you wont find what you are looking for.
gcc has several parts. The front-end translates source into one
intermediate form, from the original source language (C, C++, Fortran,
Go, Ada, etc.). The middle-end manipulates this and generates a
different intermediate form. The back-end translates this into assembly
for the given target processor (x86, ARM, MIPS, etc.). Each "end" does
a range of passes for translation, analysis, static error checking,
optimisation, etc. In theory, the "ends" are independent - in practice,
there is a fair amount of interdependence (though less than there used
to be).
But since the whole point of a compiler is to translate source code into
assembly, the "exact files" here are everything in the gcc code base
except for directories for source languages other than C, code for cpu
targets that don't interest you, and perhaps some files concerning
static error checking if they are independent from the code analysis for
optimisation.
So you are right, Ian - he won't find what he is looking for. The code
files are there, but there is no simple clear "parts of the gcc compiler
that translate source code into assembly". It's like asking "what parts
of a car make it work as a car?"
>
> You might have more luck with something less all encompassing such as TC.
>
TCC "Tiny C compiler", you mean? Yes, that would be a lot easier to
understand - though still not easy.
[toc] | [prev] | [next] | [standalone]
| From | Noob <root@127.0.0.1> |
|---|---|
| Date | 2017-01-05 09:50 +0100 |
| Message-ID | <o4l1a4$fej$1@dont-email.me> |
| In reply to | #101154 |
On 05/01/2017 05:38, DFS wrote: > I'm still wondering what parts of the gcc compiler translate source code > into assembly and/or executable machine code. > > I mentioned gcc because its source code is available - if you know where > to look, could you point out the exact gcc files that translate C source > code into assembly and machine code? GCC source code is arcane, it is not a good reference for beginners. If you're interested in compiler design, lurk in comp.compilers ans read their FAQ, they have good book suggestions. http://compilers.iecc.com/faq.txt http://compilers.iecc.com/
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2016-12-23 11:16 +0000 |
| Message-ID | <o3j105$5n7$1@dont-email.me> |
| In reply to | #100060 |
On 23/12/2016 03:47, DFS 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?
atoi() probably already exists in a binary form inside a library (in any
of .a, .o, .obj. .lib, .dll, .so files for example).
So it will have been translated at some point, but not when you compile
your program.
--
Bartc
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2016-12-23 04:36 -0800 |
| Message-ID | <d5dc2c9e-0b43-4520-b24a-fe142d502452@googlegroups.com> |
| In reply to | #100060 |
On Friday, December 23, 2016 at 3:48:17 AM UTC, DFS 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.
>
It;s virtually impossible to reverse engineer a huge hunk of
software like gcc like that. If you root around in the documentation
for developers it will tell you where the code for compiling atoi
is stored. It's probably inlined as a special function because
it is standard and so simple.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2016-12-23 13:24 -0800 |
| Message-ID | <lnk2aqbaow.fsf@kst-u.example.com> |
| In reply to | #100071 |
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
[...]
> It;s virtually impossible to reverse engineer a huge hunk of
> software like gcc like that. If you root around in the documentation
> for developers it will tell you where the code for compiling atoi
> is stored. It's probably inlined as a special function because
> it is standard and so simple.
A quick experiment shows that gcc generates a call to strtol() when
optimization is enabled. I haven't taken the time to figure out how
it does that, whether it knows that atoi() is a standard function,
or whether it takes advantage of some annotation on the declaration.
It should also be mentioned that atoi() is a poorly designed
function. It performs no error checking. atoi("FOO") is likely
to return 0, but the behavior is undefined. All the standard says
is that
Except for the behavior on error, [atoi is] equivalent to
(int)strtol(nptr, (char **)NULL, 10)
Certainly if strtol returns a result that's outside the range of int,
the cast has undefined behavior. If there's an error, the standard
doesn't say anything about how atoi behaves, which means the behavior
is undefined. (I'd be happier if it said so explicitly.)
--
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]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-12-29 01:35 +0000 |
| Message-ID | <87zijfecvt.fsf@bsb.me.uk> |
| In reply to | #100094 |
BartC <bc@freeuk.com> writes:
> On 29/12/2016 01:01, Malcolm McLean wrote:
<snip>
>> int x = atoi("NaN");
>>
>> what should x be at this point and why?
<snip>
> ... If
> it's important, verify the string before passing it to atoi.
If it's important, it's better to use strtol.
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2017-01-01 10:06 +0000 |
| Message-ID | <5868d48f.2312765@news.xs4all.nl> |
| In reply to | #100465 |
Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> BartC <bc@freeuk.com> writes:
> > On 29/12/2016 01:01, Malcolm McLean wrote:
>
> >> int x = atoi("NaN");
> >>
> >> what should x be at this point and why?
> <snip>
> > ... If
> > it's important, verify the string before passing it to atoi.
>
> If it's important, it's better to use strtol.
If it's not important, it's still better to use strtol(), because it's
no harder and might just save your bacon when it _does_ become
important.
Richard
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2016-12-28 18:33 -0800 |
| Message-ID | <lnzijf1n27.fsf@kst-u.example.com> |
| In reply to | #100094 |
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Thursday, December 29, 2016 at 12:48:50 AM UTC, Tim Rentsch wrote:
>> I think you mean something different from what this says.
>> An actual atoi() function may be perfectly fine. What I
>> think you mean is that atoi() has a specification that is
>> lacking. Your complaint is not with how atoi() itself is
>> designed and/or implemented, which may be perfectly fine,
>> but with the specification for atoi() which allows lesser
>> quality implementations.
Yes, I meant that it's specified poorly (which I thought was clear
enough from what I wrote). In fact the specification doesn't permit an
implementation to have decent quality, since it doesn't allow for decent
error handling. (I suppose a particular implementation could return
some particular value and set errno.)
> int x = atoi("NaN");
>
> what should x be at this point and why?
I believe that has undefined behavior.
--
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]
| From | Tim Rentsch <txr@alumni.caltech.edu> |
|---|---|
| Date | 2017-01-02 02:13 -0800 |
| Message-ID | <kfnd1g5u5vb.fsf@x-alumni2.alumni.caltech.edu> |
| In reply to | #100478 |
Keith Thompson <kst-u@mib.org> writes: > Malcolm McLean <malcolm.mclean5@btinternet.com> writes: >> On Thursday, December 29, 2016 at 12:48:50 AM UTC, Tim Rentsch wrote: >>> I think you mean something different from what this says. >>> An actual atoi() function may be perfectly fine. What I >>> think you mean is that atoi() has a specification that is >>> lacking. Your complaint is not with how atoi() itself is >>> designed and/or implemented, which may be perfectly fine, >>> but with the specification for atoi() which allows lesser >>> quality implementations. > > Yes, I meant that it's specified poorly (which I thought was clear > enough from what I wrote). I wasn't sure what you meant, only that it was probably different than what you wrote. > In fact the specification doesn't permit an > implementation to have decent quality, since it doesn't allow for decent > error handling. (I suppose a particular implementation could return > some particular value and set errno.) I am puzzled as to why you would say this. ISTM that the specification allows complete freedom for how an error could be handled. How does that not permit an implementation to have decent quality?
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2017-01-02 02:53 -0800 |
| Message-ID | <lnlgutwx5v.fsf@kst-u.example.com> |
| In reply to | #100854 |
Tim Rentsch <txr@alumni.caltech.edu> writes:
> Keith Thompson <kst-u@mib.org> writes:
[...]
>> In fact the specification doesn't permit an
>> implementation to have decent quality, since it doesn't allow for decent
>> error handling. (I suppose a particular implementation could return
>> some particular value and set errno.)
>
> I am puzzled as to why you would say this. ISTM that the
> specification allows complete freedom for how an error
> could be handled. How does that not permit an implementation to
> have decent quality?
atoi() returns an int result. There's no good way for it to distinguish
between a valid result and an error. I suppose it could set errno, but
other functions that do so return an error indication that lets the
caller know it needs to check errno. And if a particular implementation
adds error handling to atoi(), that doesn't help if you want to write
portable code.
--
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]
| From | Tim Rentsch <txr@alumni.caltech.edu> |
|---|---|
| Date | 2017-01-12 23:09 -0800 |
| Message-ID | <kfnshonqvv6.fsf@x-alumni2.alumni.caltech.edu> |
| In reply to | #100863 |
Keith Thompson <kst-u@mib.org> writes: > Tim Rentsch <txr@alumni.caltech.edu> writes: >> Keith Thompson <kst-u@mib.org> writes: > > [...] > >>> In fact the specification doesn't permit an >>> implementation to have decent quality, since it doesn't allow for decent >>> error handling. (I suppose a particular implementation could return >>> some particular value and set errno.) >> >> I am puzzled as to why you would say this. ISTM that the >> specification allows complete freedom for how an error >> could be handled. How does that not permit an implementation to >> have decent quality? > > atoi() returns an int result. There's no good way for it to distinguish > between a valid result and an error. How atoi() is specified now gives it complete freedom for what to do on an error. Surely one of those possibilities is a good way of distinguishing an error and a valid result. > I suppose it could set errno, but > other functions that do so return an error indication that lets the > caller know it needs to check errno. Yes, and an error return from atoi() could do that too. > And if a particular implementation > adds error handling to atoi(), that doesn't help if you want to write > portable code. That is of course true, but it has nothing to do with whether the specification allows decent error handling. I think your complaint is that the specification doesn't /force/ an implementation to provide any specific error handling, not that it doesn't /allow/ an implementation to provide a good way to handle errors. The specification does allow good error handling; it just doesn't insist on any particular way of doing so.
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2017-01-13 08:51 +0000 |
| Message-ID | <5878932a.1570296@news.xs4all.nl> |
| In reply to | #101582 |
Tim Rentsch <txr@alumni.caltech.edu> wrote: > Keith Thompson <kst-u@mib.org> writes: > > > atoi() returns an int result. There's no good way for it to distinguish > > between a valid result and an error. > > How atoi() is specified now gives it complete freedom for > what to do on an error. Surely one of those possibilities > is a good way of distinguishing an error and a valid result. Well... - How, when all values it can return are already potentially valid return values? There is no room for an error value. It returns an int, and all ints could be validly parsed. There is no int left to indicate "not validly parsed". - Any single implementation of atoi() could fudge it, possibly by forbidding the parsing of one specific int value (of dubious legality, but a workable hack in some circumstances), and certainly by setting errno; but no portable program can afford to rely on any of those methods, because not all of them will chose the same method (or, in the case of the first one, value). > > And if a particular implementation > > adds error handling to atoi(), that doesn't help if you want to write > > portable code. > > That is of course true, but it has nothing to do with whether the > specification allows decent error handling. I think your > complaint is that the specification doesn't /force/ an > implementation to provide any specific error handling, not that > it doesn't /allow/ an implementation to provide a good way to > handle errors. The specification does allow good error handling; > it just doesn't insist on any particular way of doing so. Yes, and the problem is that since it doesn't insist on any particular way or even insist that any error handling is used at all, no user-programmer can rely on it. Therefore, use strtol(). It is reliable, and no more complicated to use than any error-handling atoi() would be. Only a stubborn fool would use atoi() when strtol() is available. Richard
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2017-01-13 10:28 +0000 |
| Message-ID | <87y3yfp839.fsf@bsb.me.uk> |
| In reply to | #101585 |
raltbos@xs4all.nl (Richard Bos) writes:
> Tim Rentsch <txr@alumni.caltech.edu> wrote:
>
>> Keith Thompson <kst-u@mib.org> writes:
>>
>> > atoi() returns an int result. There's no good way for it to distinguish
>> > between a valid result and an error.
>>
>> How atoi() is specified now gives it complete freedom for
>> what to do on an error. Surely one of those possibilities
>> is a good way of distinguishing an error and a valid result.
>
> Well...
>
> - How, when all values it can return are already potentially valid
> return values? There is no room for an error value. It returns an
> int, and all ints could be validly parsed. There is no int left to
> indicate "not validly parsed".
Distinguishing between an error and a valid result does not have to be
done through the result itself. It could be a simple as
extern const char *_atoi_endptr;
int atoi(const char *nptr)
{
long r = strtol(nptr, &_atoi_endptr, 10);
if (r < INT_MIN || r > INT_MAX)
_atoi_endptr = nptr;
return r;
}
On error, returning an adjusted value might be more useful, but that's
not really central to the point.
<snip>
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2017-01-13 10:00 -0800 |
| Message-ID | <lnd1fqn8lp.fsf@kst-u.example.com> |
| In reply to | #101591 |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> raltbos@xs4all.nl (Richard Bos) writes:
>> Tim Rentsch <txr@alumni.caltech.edu> wrote:
>>> Keith Thompson <kst-u@mib.org> writes:
>>> > atoi() returns an int result. There's no good way for it to distinguish
>>> > between a valid result and an error.
>>>
>>> How atoi() is specified now gives it complete freedom for
>>> what to do on an error. Surely one of those possibilities
>>> is a good way of distinguishing an error and a valid result.
>>
>> Well...
>>
>> - How, when all values it can return are already potentially valid
>> return values? There is no room for an error value. It returns an
>> int, and all ints could be validly parsed. There is no int left to
>> indicate "not validly parsed".
>
> Distinguishing between an error and a valid result does not have to be
> done through the result itself. It could be a simple as
>
> extern const char *_atoi_endptr;
>
> int atoi(const char *nptr)
> {
> long r = strtol(nptr, &_atoi_endptr, 10);
> if (r < INT_MIN || r > INT_MAX)
> _atoi_endptr = nptr;
> return r;
> }
>
> On error, returning an adjusted value might be more useful, but that's
> not really central to the point.
>
> <snip>
My intent was that solutions like that are included by the word "decent"
in the phrase "decent error handling". This particular method is no
better than setting errno -- in fact, setting errno is thread-safe.
--
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]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2017-01-13 10:34 -0800 |
| Message-ID | <d65044b1-2bc4-475f-aec1-de6b5f48ad74@googlegroups.com> |
| In reply to | #101631 |
On Friday, January 13, 2017 at 11:59:55 AM UTC-6, Keith Thompson wrote: > My intent was that solutions like that are included by the word "decent" > in the phrase "decent error handling". This particular method is no > better than setting errno -- in fact, setting errno is thread-safe. Anything will be thread-safe in a system which can only support one thread (common on some platforms), and systems with multiple threads may define other error-flag variables with better semantics than errno. For example, an implementation may provide each thread with 32 or 64 single-bit error flags and specify that they should be treated in "latching" function. Code which wants to find out if a particular call succeeded without trouble independent of anything that happened previously would need to save and clear the flags, perform the operation, test the flag, and then restore the flags, but code which wanted to test whether an entire sequence completed without trouble would only need to test the flag once. Such a design would not really be practical with errno().
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2017-01-18 21:00 +0000 |
| Message-ID | <587fd6cc.13701531@news.xs4all.nl> |
| In reply to | #101591 |
Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: > raltbos@xs4all.nl (Richard Bos) writes: > > Tim Rentsch <txr@alumni.caltech.edu> wrote: > >> Keith Thompson <kst-u@mib.org> writes: > >> > >> > atoi() returns an int result. There's no good way for it to distinguish > >> > between a valid result and an error. > >> > >> How atoi() is specified now gives it complete freedom for > >> what to do on an error. Surely one of those possibilities > >> is a good way of distinguishing an error and a valid result. > > > > Well... > > > > - How, when all values it can return are already potentially valid > > return values? There is no room for an error value. It returns an > > int, and all ints could be validly parsed. There is no int left to > > indicate "not validly parsed". > > Distinguishing between an error and a valid result does not have to be > done through the result itself. True, but I adressed that in the second point. There are indeed several options open to an implementor of atoi(); and that's precisely the problem. A user-programmer can't even rely on atoi() doing _anything_ on error, let alone on it doing anything specific. Richard
[toc] | [prev] | [next] | [standalone]
Page 7 of 9 — ← Prev page 1 2 3 4 5 6 [7] 8 9 Next page →
Back to top | Article view | comp.lang.c
csiph-web