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


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

Right C version for GCC

Started by"Morten W. Petersen" <morphex@gmail.com>
First post2015-11-08 16:49 +0100
Last post2015-11-12 14:39 +0100
Articles 20 on this page of 181 — 23 participants

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


Contents

  Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-08 16:49 +0100
    Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-08 19:29 +0100
    Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-08 11:46 -0800
      Re: Right C version for GCC Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-11-08 20:03 +0000
        Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-08 12:18 -0800
      Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-08 21:14 +0100
        Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-08 12:25 -0800
          Re: Right C version for GCC supercat@casperkitty.com - 2015-11-08 13:06 -0800
            Re: Right C version for GCC Philip Lantz <prl@canterey.us> - 2015-11-08 14:52 -0800
              Re: Right C version for GCC supercat@casperkitty.com - 2015-11-08 15:12 -0800
                Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-09 09:38 +0100
                Re: Right C version for GCC Nick Bowler <nbowler@draconx.ca> - 2015-11-09 19:04 +0000
                  Re: Right C version for GCC supercat@casperkitty.com - 2015-11-09 11:27 -0800
              Re: Right C version for GCC BartC <bc@freeuk.com> - 2015-11-09 00:00 +0000
          Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-08 16:35 -0800
      Re: Right C version for GCC supercat@casperkitty.com - 2015-11-08 12:37 -0800
        Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-08 12:58 -0800
          Re: Right C version for GCC supercat@casperkitty.com - 2015-11-08 13:19 -0800
      Re: Right C version for GCC Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-08 21:49 +0000
        Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-08 14:14 -0800
          Re: Right C version for GCC Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-09 01:02 +0000
            Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-09 02:26 -0800
              Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-09 12:53 +0100
              Re: Right C version for GCC Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-09 15:00 +0000
                Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-09 08:55 -0800
                  Re: Right C version for GCC Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-09 17:07 +0000
                  Re: Right C version for GCC supercat@casperkitty.com - 2015-11-09 09:51 -0800
                    Re: Right C version for GCC jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-09 19:01 +0100
                      Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 19:16 +0100
                      Re: Right C version for GCC supercat@casperkitty.com - 2015-11-09 11:24 -0800
                        Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 20:30 +0100
                        Re: Right C version for GCC jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-09 20:40 +0100
              Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 08:56 -0800
                Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-09 09:41 -0800
                  Re: Right C version for GCC gazelle@shell.xmission.com (Kenny McCormack) - 2015-11-09 17:44 +0000
                  Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-09 18:53 +0100
                  Re: Right C version for GCC Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-09 18:00 +0000
                    Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-09 10:27 -0800
                      Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 11:17 -0800
                        Re: Right C version for GCC glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-09 22:59 +0000
                    Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 11:15 -0800
                      Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-12 16:47 +0100
                        Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-12 09:24 -0800
                          Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-13 12:54 +0100
                            Re: Right C version for GCC Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-13 12:01 -0800
                              Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-14 10:47 -0800
                                Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-14 21:32 +0100
                                Re: Right C version for GCC Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-14 16:57 -0800
                  Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 11:07 -0800
                    Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 20:18 +0100
                      Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 11:27 -0800
                        Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 20:41 +0100
                          Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 12:07 -0800
                            Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 21:12 +0100
                            Re: Right C version for GCC glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-09 23:13 +0000
                              Re: Right C version for GCC James Kuyper <jameskuyper@verizon.net> - 2015-11-09 19:02 -0500
                              Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-10 17:52 +0000
                                Re: Right C version for GCC glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-10 21:34 +0000
                                  Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-17 22:28 +0000
                                    Re: Right C version for GCC glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-18 00:51 +0000
                                      Re: Right C version for GCC James Kuyper <jameskuyper@verizon.net> - 2015-11-17 22:26 -0500
                                    Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-18 11:06 +0100
                            Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-09 15:37 -0800
                              Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-10 12:54 +1300
                              Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 16:14 -0800
                                Re: Right C version for GCC supercat@casperkitty.com - 2015-11-09 16:37 -0800
                                  Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 16:56 -0800
                                    Re: Right C version for GCC supercat@casperkitty.com - 2015-11-09 17:25 -0800
                                    Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 10:37 +0100
                                Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-09 18:06 -0800
                                  Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 18:51 -0800
                                  Re: Right C version for GCC supercat@casperkitty.com - 2015-11-10 08:40 -0800
                                  Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-10 17:55 +0000
                          Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-10 17:50 +0000
                            Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-12 14:32 +0100
            Re: Right C version for GCC Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-11-09 10:35 +0000
        Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-08 23:57 +0100
          Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 00:47 +0100
            Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-09 13:01 +0100
              Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 13:18 +0100
                Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-09 14:01 +0100
          Re: Right C version for GCC Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-09 00:55 +0000
            Re: Right C version for GCC Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-11-09 10:42 +0000
              Re: Right C version for GCC Chad <cdalten@gmail.com> - 2015-11-09 03:03 -0800
                Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-09 03:27 -0800
                  Re: Right C version for GCC BartC <bc@freeuk.com> - 2015-11-09 12:28 +0000
                    Re: Right C version for GCC Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-11-10 09:07 +0000
                Re: Right C version for GCC James Kuyper <jameskuyper@verizon.net> - 2015-11-09 07:37 -0500
              Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-09 16:57 +0100
        Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-09 12:39 +0100
          Re: Right C version for GCC James Kuyper <jameskuyper@verizon.net> - 2015-11-09 13:18 -0500
            Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 10:49 +0100
              Re: Right C version for GCC Les Cargill <lcargill99@comcast.com> - 2015-11-10 19:33 -0600
                Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-11 13:34 +0100
                  Re: Right C version for GCC supercat@casperkitty.com - 2015-11-11 06:53 -0800
      Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-08 17:00 -0800
        Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-09 13:37 +0100
        Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-09 13:53 +0100
      Re: Right C version for GCC BartC <bc@freeuk.com> - 2015-11-09 21:54 +0000
        Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-09 15:45 -0800
          Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 11:14 +0100
            Re: Right C version for GCC BartC <bc@freeuk.com> - 2015-11-10 10:53 +0000
            Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-10 03:14 -0800
              Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 13:00 +0100
                Re: Right C version for GCC BartC <bc@freeuk.com> - 2015-11-10 12:39 +0000
                  Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 15:11 +0100
                    Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-10 16:16 +0100
                      Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 16:35 +0100
                    Re: Right C version for GCC supercat@casperkitty.com - 2015-11-10 08:54 -0800
                      Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 18:56 +0100
                        Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-10 23:27 +0100
                        Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-17 22:32 +0000
                          Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-18 08:44 +0100
                            Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-19 10:43 +0000
                              Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-19 12:29 +0100
                                Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-20 11:01 +0000
                                  Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-21 15:50 +0100
                          Re: Right C version for GCC Philipp Klaus Krause <pkk@spth.de> - 2015-11-18 11:13 +0100
                Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-10 07:25 -0800
                  Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 16:42 +0100
                    Re: Right C version for GCC supercat@casperkitty.com - 2015-11-10 08:48 -0800
                    Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-11 01:08 -0800
                      Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-11 13:43 +0100
                        Re: Right C version for GCC Les Cargill <lcargill99@comcast.com> - 2015-11-11 08:27 -0600
                          Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-11 16:27 +0100
                    Re: Right C version for GCC David Thompson <dave.thompson2@verizon.net> - 2015-12-06 07:57 -0500
                      Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-12-06 22:34 +0100
                        Re: Right C version for GCC Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-12-06 22:41 +0000
                          Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-12-07 09:47 +0100
                            Re: Right C version for GCC supercat@casperkitty.com - 2015-12-07 07:30 -0800
                              Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-12-07 17:30 +0100
                                Re: Right C version for GCC supercat@casperkitty.com - 2015-12-07 10:17 -0800
                                  Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-12-07 21:29 +0100
                                    Re: Right C version for GCC supercat@casperkitty.com - 2015-12-07 13:16 -0800
                                      Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-12-07 23:35 +0100
                                Re: Right C version for GCC jadill33@gmail.com - 2015-12-07 10:41 -0800
                                  Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-12-07 21:35 +0100
    Re: Right C version for GCC Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-11-08 20:11 +0000
    Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-09 09:57 +1300
      Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-08 13:06 -0800
        Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-09 10:16 +1300
          Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-08 22:59 +0100
            Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-09 12:13 +1300
              Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 00:43 +0100
                Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-09 13:00 +1300
                  Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 12:02 +0100
                    Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 09:00 -0800
                    Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-10 07:25 +1300
                      Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 19:35 +0100
                        Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-10 08:55 +1300
                          Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 21:00 +0100
                            Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-10 09:04 +1300
                              Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 21:11 +0100
                                Re: Right C version for GCC Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-09 20:18 +0000
                                  Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 21:21 +0100
                                    Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-10 09:30 +1300
                                    Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 12:53 -0800
                                Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-09 12:30 -0800
                                  Re: Right C version for GCC supercat@casperkitty.com - 2015-11-09 13:02 -0800
                                    Re: Right C version for GCC BartC <bc@freeuk.com> - 2015-11-09 21:35 +0000
                                      Re: Right C version for GCC supercat@casperkitty.com - 2015-11-09 14:41 -0800
                                        Re: Right C version for GCC BartC <bc@freeuk.com> - 2015-11-09 23:31 +0000
                                          Re: Right C version for GCC supercat@casperkitty.com - 2015-11-09 16:33 -0800
                              Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-10 11:16 +0100
                                Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-11 08:04 +1300
                              Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-10 18:04 +0000
                          Re: Right C version for GCC raltbos@xs4all.nl (Richard Bos) - 2015-11-10 18:03 +0000
                            Re: Right C version for GCC Ian Collins <ian-news@hotmail.com> - 2015-11-11 08:23 +1300
            Re: Right C version for GCC David Brown <david.brown@hesbynett.no> - 2015-11-09 13:41 +0100
        Re: Right C version for GCC supercat@casperkitty.com - 2015-11-08 13:24 -0800
        Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-08 23:00 +0100
          Re: Right C version for GCC Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-08 15:18 -0800
            Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 00:35 +0100
            Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-08 17:03 -0800
              Re: Right C version for GCC Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-11-09 12:42 +0000
    Re: Right C version for GCC Keith Thompson <kst-u@mib.org> - 2015-11-08 17:51 -0800
    Re: Right C version for GCC Les Cargill <lcargill99@comcast.com> - 2015-11-09 12:20 -0600
      Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-09 19:36 +0100
      Re: Right C version for GCC BartC <bc@freeuk.com> - 2015-11-09 18:47 +0000
    Re: Right C version for GCC Stephen Sprunk <stephen@sprunk.org> - 2015-11-11 00:55 -0600
      Re: Right C version for GCC "Morten W. Petersen" <morphex@gmail.com> - 2015-11-12 14:39 +0100

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


#75375

FromIan Collins <ian-news@hotmail.com>
Date2015-11-09 10:16 +1300
Message-ID<da9se9FjinoU5@mid.individual.net>
In reply to#75374
Malcolm McLean wrote:
> On Sunday, November 8, 2015 at 8:57:14 PM UTC, Ian Collins wrote:
>>
>> Just stick with contemporary C (C99), there's a very slim chance anyone
>> will want an XML parser on a system without a C99 compiler.
>>
> The chance that someone will want to drop an XML parser into a
> Microsoft Visual Studio program is pretty high. You can of course
> obtain an C99 compiler for Windows. But unless the XML parser is
> a vital core component, a developer will be unwilling to switch
> compilers just so he can use one XML system.

His code as it stands won't compile as C90, but with one minor nit, it 
does as C99.  It also contains at least one POSIX function (fileno).

-- 
Ian Collins

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


#75385

From"Morten W. Petersen" <morphex@gmail.com>
Date2015-11-08 22:59 +0100
Message-ID<n1ogid$5vo$1@speranza.aioe.org>
In reply to#75375
On 08.11.2015 22:16, Ian Collins wrote:
> Malcolm McLean wrote:
>> On Sunday, November 8, 2015 at 8:57:14 PM UTC, Ian Collins wrote:
>>>
>>> Just stick with contemporary C (C99), there's a very slim chance anyone
>>> will want an XML parser on a system without a C99 compiler.
>>>
>> The chance that someone will want to drop an XML parser into a
>> Microsoft Visual Studio program is pretty high. You can of course
>> obtain an C99 compiler for Windows. But unless the XML parser is
>> a vital core component, a developer will be unwilling to switch
>> compilers just so he can use one XML system.
>
> His code as it stands won't compile as C90, but with one minor nit, it
> does as C99.  It also contains at least one POSIX function (fileno).

Well I'm aware of fileno, it triggers a warning.  But what other nit
did you find?

I downloaded a VirtualBox image of CentOS 6.6, which has an older GCC
version, this made me aware of the issues with nested structures, and
I don't quite like surprises like that.

-Morten

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


#75399

FromIan Collins <ian-news@hotmail.com>
Date2015-11-09 12:13 +1300
Message-ID<daa384FjinoU6@mid.individual.net>
In reply to#75385
Morten W. Petersen wrote:
> On 08.11.2015 22:16, Ian Collins wrote:
>> Malcolm McLean wrote:
>>> On Sunday, November 8, 2015 at 8:57:14 PM UTC, Ian Collins wrote:
>>>>
>>>> Just stick with contemporary C (C99), there's a very slim chance anyone
>>>> will want an XML parser on a system without a C99 compiler.
>>>>
>>> The chance that someone will want to drop an XML parser into a
>>> Microsoft Visual Studio program is pretty high. You can of course
>>> obtain an C99 compiler for Windows. But unless the XML parser is
>>> a vital core component, a developer will be unwilling to switch
>>> compilers just so he can use one XML system.
>>
>> His code as it stands won't compile as C90, but with one minor nit, it
>> does as C99.  It also contains at least one POSIX function (fileno).
>
> Well I'm aware of fileno, it triggers a warning.  But what other nit
> did you find?

(I had to add "string.h" where required)

gcc -std=c99 -Wall -pedantic decode_xml.c -g -o decode_xml -I. -DTEST
In file included from decode_xml.c:5:0:
./globals.h:165:4: warning: ISO C99 doesn’t support unnamed 
structs/unions [-Wpedantic]
    };
     ^
decode_xml.c:647:2: warning: ISO C does not allow extra ‘;’ outside of a 
function [-Wpedantic]
  };
   ^

So it actually requires C11 to get unnamed structs/union support:

gcc -std=c11 -Wall -pedantic decode_xml.c -g -o decode_xml -I. -DTEST
In file included from decode_xml.c:5:0:
./globals.h:166:1: warning: no semicolon at end of struct or union
  };
  ^
decode_xml.c:647:2: warning: ISO C does not allow extra ‘;’ outside of a 
function [-Wpedantic]
  };
   ^

My other compiler goes a step further:

cc -std=c11 decode_xml.c -g -o decode_xml -I. -DTEST
"./globals.h", line 166: warning: syntax requires ";" after last 
struct/union member
"decode_xml.c", line 14: warning: statement not reached
"decode_xml.c", line 647: warning: syntax error:  empty declaration
"decode_xml.c", line 799: warning: integer overflow detected: op "<<"

-- 
Ian Collins

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


#75402

From"Morten W. Petersen" <morphex@gmail.com>
Date2015-11-09 00:43 +0100
Message-ID<n1omm1$j4r$1@speranza.aioe.org>
In reply to#75399
On 09.11.2015 00:13, Ian Collins wrote:
> Morten W. Petersen wrote:
>> On 08.11.2015 22:16, Ian Collins wrote:
>>> Malcolm McLean wrote:
>>>> On Sunday, November 8, 2015 at 8:57:14 PM UTC, Ian Collins wrote:
>>>>>
>>>>> Just stick with contemporary C (C99), there's a very slim chance
>>>>> anyone
>>>>> will want an XML parser on a system without a C99 compiler.
>>>>>
>>>> The chance that someone will want to drop an XML parser into a
>>>> Microsoft Visual Studio program is pretty high. You can of course
>>>> obtain an C99 compiler for Windows. But unless the XML parser is
>>>> a vital core component, a developer will be unwilling to switch
>>>> compilers just so he can use one XML system.
>>>
>>> His code as it stands won't compile as C90, but with one minor nit, it
>>> does as C99.  It also contains at least one POSIX function (fileno).
>>
>> Well I'm aware of fileno, it triggers a warning.  But what other nit
>> did you find?
>
> (I had to add "string.h" where required)

decode_xml.c has string.h..  tests.c is included in that, and the rest
of the .c files were just code to test different things.

Where did you have to add string.h?

> gcc -std=c99 -Wall -pedantic decode_xml.c -g -o decode_xml -I. -DTEST
> In file included from decode_xml.c:5:0:
> ./globals.h:165:4: warning: ISO C99 doesn’t support unnamed
> structs/unions [-Wpedantic]
>     };
>      ^
> decode_xml.c:647:2: warning: ISO C does not allow extra ‘;’ outside of a
> function [-Wpedantic]
>   };
>    ^
>
> So it actually requires C11 to get unnamed structs/union support:
>
> gcc -std=c11 -Wall -pedantic decode_xml.c -g -o decode_xml -I. -DTEST
> In file included from decode_xml.c:5:0:
> ./globals.h:166:1: warning: no semicolon at end of struct or union
>   };
>   ^
> decode_xml.c:647:2: warning: ISO C does not allow extra ‘;’ outside of a
> function [-Wpedantic]
>   };
>    ^
>
> My other compiler goes a step further:
>
> cc -std=c11 decode_xml.c -g -o decode_xml -I. -DTEST
> "./globals.h", line 166: warning: syntax requires ";" after last
> struct/union member
> "decode_xml.c", line 14: warning: statement not reached
> "decode_xml.c", line 647: warning: syntax error:  empty declaration
> "decode_xml.c", line 799: warning: integer overflow detected: op "<<"

I compiled now using -std=iso9899:199409 and -fms-extensions, and got
a whole truckload of warnings about mixing declarations and code.

I like declaring a value and setting the value in one go, but strict
is strict so I'll just add a semicolon between to get rid of those.

-Morten

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


#75405

FromIan Collins <ian-news@hotmail.com>
Date2015-11-09 13:00 +1300
Message-ID<daa612FjinoU7@mid.individual.net>
In reply to#75402
Morten W. Petersen wrote:
> On 09.11.2015 00:13, Ian Collins wrote:
>>
>> (I had to add "string.h" where required)
>
> decode_xml.c has string.h..  tests.c is included in that, and the rest
> of the .c files were just code to test different things.
>
> Where did you have to add string.h?

makeheaders.c

also globals.h required stdint.h.

<snip>

>> My other compiler goes a step further:
>>
>> cc -std=c11 decode_xml.c -g -o decode_xml -I. -DTEST
>> "./globals.h", line 166: warning: syntax requires ";" after last
>> struct/union member
>> "decode_xml.c", line 14: warning: statement not reached
>> "decode_xml.c", line 647: warning: syntax error:  empty declaration
>> "decode_xml.c", line 799: warning: integer overflow detected: op "<<"
>
> I compiled now using -std=iso9899:199409 and -fms-extensions, and got
> a whole truckload of warnings about mixing declarations and code.

Why don't you just use the "normal" std values?

> I like declaring a value and setting the value in one go, but strict
> is strict so I'll just add a semicolon between to get rid of those.

If you prefer mixing declarations and code (the best addition to C99 
IMHO), you need std>=c99.

You would be well advised to adopt the strict checking flags recommended 
in earlier threads.
-- 
Ian Collins

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


#75431

From"Morten W. Petersen" <morphex@gmail.com>
Date2015-11-09 12:02 +0100
Message-ID<n1puer$9b5$1@speranza.aioe.org>
In reply to#75405
On 09.11.2015 01:00, Ian Collins wrote:
> Morten W. Petersen wrote:
>> On 09.11.2015 00:13, Ian Collins wrote:
>>>
>>> (I had to add "string.h" where required)
>>
>> decode_xml.c has string.h..  tests.c is included in that, and the rest
>> of the .c files were just code to test different things.
>>
>> Where did you have to add string.h?
>
> makeheaders.c
>
> also globals.h required stdint.h.

OK.  How did you figure that these were missing?

> <snip>
>
>>> My other compiler goes a step further:
>>>
>>> cc -std=c11 decode_xml.c -g -o decode_xml -I. -DTEST
>>> "./globals.h", line 166: warning: syntax requires ";" after last
>>> struct/union member
>>> "decode_xml.c", line 14: warning: statement not reached
>>> "decode_xml.c", line 647: warning: syntax error:  empty declaration
>>> "decode_xml.c", line 799: warning: integer overflow detected: op "<<"
>>
>> I compiled now using -std=iso9899:199409 and -fms-extensions, and got
>> a whole truckload of warnings about mixing declarations and code.
>
> Why don't you just use the "normal" std values?

Well, I got lost somewhere there, it used to be -std=c90 but my version
of GCC doesn't support that option, so the closest seems to be
std=iso9899:1990.

>> I like declaring a value and setting the value in one go, but strict
>> is strict so I'll just add a semicolon between to get rid of those.
>
> If you prefer mixing declarations and code (the best addition to C99
> IMHO), you need std>=c99.
>
> You would be well advised to adopt the strict checking flags recommended
> in earlier threads.

Well I've got -Wall and -pedantic now, do I need anything else?

As for the version of C, C90 is good enough for me.

-Morten

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


#75463

FromKeith Thompson <kst-u@mib.org>
Date2015-11-09 09:00 -0800
Message-ID<ln4mgvyuoq.fsf@kst-u.example.com>
In reply to#75431
"Morten W. Petersen" <morphex@gmail.com> writes:
[...]
> Well, I got lost somewhere there, it used to be -std=c90 but my version
> of GCC doesn't support that option, so the closest seems to be
> std=iso9899:1990.

Just use "-std=c89" or "-ansi".

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


#75478

FromIan Collins <ian-news@hotmail.com>
Date2015-11-10 07:25 +1300
Message-ID<dac6p3FebevU2@mid.individual.net>
In reply to#75431
Morten W. Petersen wrote:
> On 09.11.2015 01:00, Ian Collins wrote:
>>
>> If you prefer mixing declarations and code (the best addition to C99
>> IMHO), you need std>=c99.
>>
>> You would be well advised to adopt the strict checking flags recommended
>> in earlier threads.
>
> Well I've got -Wall and -pedantic now, do I need anything else?
>
> As for the version of C, C90 is good enough for me.

But not for your code...

-- 
Ian Collins

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


#75480

From"Morten W. Petersen" <morphex@gmail.com>
Date2015-11-09 19:35 +0100
Message-ID<n1qp07$cq6$1@speranza.aioe.org>
In reply to#75478
On 09.11.2015 19:25, Ian Collins wrote:
> Morten W. Petersen wrote:
>> On 09.11.2015 01:00, Ian Collins wrote:
>>>
>>> If you prefer mixing declarations and code (the best addition to C99
>>> IMHO), you need std>=c99.
>>>
>>> You would be well advised to adopt the strict checking flags recommended
>>> in earlier threads.
>>
>> Well I've got -Wall and -pedantic now, do I need anything else?
>>
>> As for the version of C, C90 is good enough for me.
>
> But not for your code...

Well I'll adjust the code.  I don't see any benefits beyond C90 for
this XML parser and then some project.

-Morten

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


#75501

FromIan Collins <ian-news@hotmail.com>
Date2015-11-10 08:55 +1300
Message-ID<dacc15FebevU4@mid.individual.net>
In reply to#75480
Morten W. Petersen wrote:
> On 09.11.2015 19:25, Ian Collins wrote:
>> Morten W. Petersen wrote:
>>> On 09.11.2015 01:00, Ian Collins wrote:
>>>>
>>>> If you prefer mixing declarations and code (the best addition to C99
>>>> IMHO), you need std>=c99.
>>>>
>>>> You would be well advised to adopt the strict checking flags recommended
>>>> in earlier threads.
>>>
>>> Well I've got -Wall and -pedantic now, do I need anything else?
>>>
>>> As for the version of C, C90 is good enough for me.
>>
>> But not for your code...
>
> Well I'll adjust the code.  I don't see any benefits beyond C90 for
> this XML parser and then some project.

If you don't see any benefits, why have you taken advantage of more 
modern C in your code?

I wouldn't worry about Microsoft, their aim of C++14 compliance will 
bring their compiler a lot closer to C99 compliance.

-- 
Ian Collins

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


#75503

From"Morten W. Petersen" <morphex@gmail.com>
Date2015-11-09 21:00 +0100
Message-ID<n1qu06$olv$1@speranza.aioe.org>
In reply to#75501
On 09.11.2015 20:55, Ian Collins wrote:
> Morten W. Petersen wrote:
>> On 09.11.2015 19:25, Ian Collins wrote:
>>> Morten W. Petersen wrote:
>>>> On 09.11.2015 01:00, Ian Collins wrote:
>>>>>
>>>>> If you prefer mixing declarations and code (the best addition to C99
>>>>> IMHO), you need std>=c99.
>>>>>
>>>>> You would be well advised to adopt the strict checking flags
>>>>> recommended
>>>>> in earlier threads.
>>>>
>>>> Well I've got -Wall and -pedantic now, do I need anything else?
>>>>
>>>> As for the version of C, C90 is good enough for me.
>>>
>>> But not for your code...
>>
>> Well I'll adjust the code.  I don't see any benefits beyond C90 for
>> this XML parser and then some project.
>
> If you don't see any benefits, why have you taken advantage of more
> modern C in your code?

It was an example posted here IIRC, which was neat.

> I wouldn't worry about Microsoft, their aim of C++14 compliance will
> bring their compiler a lot closer to C99 compliance.

Yeah, well I just hope it isn't difficult to support their compiler,
seeing how they've played games before and wasted a lot of developer
time.

-Morten

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


#75504

FromIan Collins <ian-news@hotmail.com>
Date2015-11-10 09:04 +1300
Message-ID<daccijFebevU5@mid.individual.net>
In reply to#75503
Morten W. Petersen wrote:
> On 09.11.2015 20:55, Ian Collins wrote:
>> Morten W. Petersen wrote:
>>> On 09.11.2015 19:25, Ian Collins wrote:
>>>> Morten W. Petersen wrote:
>>>>> On 09.11.2015 01:00, Ian Collins wrote:
>>>>>>
>>>>>> If you prefer mixing declarations and code (the best addition to C99
>>>>>> IMHO), you need std>=c99.
>>>>>>
>>>>>> You would be well advised to adopt the strict checking flags
>>>>>> recommended
>>>>>> in earlier threads.
>>>>>
>>>>> Well I've got -Wall and -pedantic now, do I need anything else?
>>>>>
>>>>> As for the version of C, C90 is good enough for me.
>>>>
>>>> But not for your code...
>>>
>>> Well I'll adjust the code.  I don't see any benefits beyond C90 for
>>> this XML parser and then some project.
>>
>> If you don't see any benefits, why have you taken advantage of more
>> modern C in your code?
>
> It was an example posted here IIRC, which was neat.

Hang on, haven't we already established that your code requires C11 to 
compile?  You stated somewhere up-thread that you value mixed 
declaration and code (added in C99).

>> I wouldn't worry about Microsoft, their aim of C++14 compliance will
>> bring their compiler a lot closer to C99 compliance.
>
> Yeah, well I just hope it isn't difficult to support their compiler,
> seeing how they've played games before and wasted a lot of developer
> time.

They are publicly and practically committed to C++14 compliance.

-- 
Ian Collins

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


#75506

From"Morten W. Petersen" <morphex@gmail.com>
Date2015-11-09 21:11 +0100
Message-ID<n1qulc$qlk$1@speranza.aioe.org>
In reply to#75504
On 09.11.2015 21:04, Ian Collins wrote:
> Morten W. Petersen wrote:
[...]
>> It was an example posted here IIRC, which was neat.
>
> Hang on, haven't we already established that your code requires C11 to
> compile?  You stated somewhere up-thread that you value mixed
> declaration and code (added in C99).

Going further back, after discussions on this group, I found that C90
is the way to go.

I recently discovered that nesting wasn't supported in C90 when I used
an old version of GCC.

>>> I wouldn't worry about Microsoft, their aim of C++14 compliance will
>>> bring their compiler a lot closer to C99 compliance.
>>
>> Yeah, well I just hope it isn't difficult to support their compiler,
>> seeing how they've played games before and wasted a lot of developer
>> time.
>
> They are publicly and practically committed to C++14 compliance.

Yeah well seeing how they have behaved over time and that their
interest is in keeping developers tied to their platform, I'm
not holding my breath.

Maybe it's a matter of corporate culture, disrespect, greed, etc.
I don't know but that's my opinion after seeing what they have
done over many years.

-Morten

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


#75508

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2015-11-09 20:18 +0000
Message-ID<87egfzncy4.fsf@bsb.me.uk>
In reply to#75506
"Morten W. Petersen" <morphex@gmail.com> writes:
<snip>
> I recently discovered that nesting wasn't supported in C90 when I used
> an old version of GCC.

That's going to confuse some people.  I suspect you mean that anonymous
structure and union members are not supported (but that's a guess).
Nesting is a very general term.

<snip>
-- 
Ben.

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


#75509

From"Morten W. Petersen" <morphex@gmail.com>
Date2015-11-09 21:21 +0100
Message-ID<n1qv6m$qlk$3@speranza.aioe.org>
In reply to#75508
On 09.11.2015 21:18, Ben Bacarisse wrote:
> "Morten W. Petersen" <morphex@gmail.com> writes:
> <snip>
>> I recently discovered that nesting wasn't supported in C90 when I used
>> an old version of GCC.
>
> That's going to confuse some people.  I suspect you mean that anonymous
> structure and union members are not supported (but that's a guess).
> Nesting is a very general term.

It's this thing:

https://github.com/morphex/smash_xml/blob/master/globals.h#L146

-Morten

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


#75512

FromIan Collins <ian-news@hotmail.com>
Date2015-11-10 09:30 +1300
Message-ID<dace3jFebevU6@mid.individual.net>
In reply to#75509
Morten W. Petersen wrote:
> On 09.11.2015 21:18, Ben Bacarisse wrote:
>> "Morten W. Petersen" <morphex@gmail.com> writes:
>> <snip>
>>> I recently discovered that nesting wasn't supported in C90 when I used
>>> an old version of GCC.
>>
>> That's going to confuse some people.  I suspect you mean that anonymous
>> structure and union members are not supported (but that's a guess).
>> Nesting is a very general term.
>
> It's this thing:
>
> https://github.com/morphex/smash_xml/blob/master/globals.h#L146

Which is an anonymous (unnamed) struct.

Support for unnamed struct members has nothing to do with the gcc 
version, it is a language feature added in C11.

-- 
Ian Collins

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


#75514

FromKeith Thompson <kst-u@mib.org>
Date2015-11-09 12:53 -0800
Message-ID<lnpozix5az.fsf@kst-u.example.com>
In reply to#75509
"Morten W. Petersen" <morphex@gmail.com> writes:
> On 09.11.2015 21:18, Ben Bacarisse wrote:
>> "Morten W. Petersen" <morphex@gmail.com> writes:
>> <snip>
>>> I recently discovered that nesting wasn't supported in C90 when I used
>>> an old version of GCC.
>>
>> That's going to confuse some people.  I suspect you mean that anonymous
>> structure and union members are not supported (but that's a guess).
>> Nesting is a very general term.
>
> It's this thing:
>
> https://github.com/morphex/smash_xml/blob/master/globals.h#L146

The code at the link is:

struct xml_item {
  small_int type;
  struct xml_item *parent, *next, *previous;

  union {
    struct xml_element {
      unicode_char *name;
      struct xml_item *attributes;
      struct xml_item *child;
    } element;

    struct xml_attribute {
      unicode_char *name, *content;
    } attribute;

    struct xml_text {
      unicode_char *characters;
    } text;
  };
};

The union is an *anonymous union* member of the structure `struct
xml_item`.  It's supported as an extension by gcc, and as a standard
feature starting with C11.  The code can be made more portable by giving
a name to the union member and then using that name in references to
members of the union.  For example `obj.element.name` would have to be
written as `obj.u.element.name`.  (You *could* define a set of macros to
achieve the same effect, but I wouldn't recommend it.)

Referring to this as "nesting" is unclear and confusing.  To avoid
confusion, please refer instead to "anonymous structures" and/or
"anonymous unions".

(Ordinary nesting of (named) structures and unions is fully supported in
C89/C90 and even earlier.)

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


#75511

FromKeith Thompson <kst-u@mib.org>
Date2015-11-09 12:30 -0800
Message-ID<lnwptqx6dy.fsf@kst-u.example.com>
In reply to#75506
"Morten W. Petersen" <morphex@gmail.com> writes:
> On 09.11.2015 21:04, Ian Collins wrote:
>> Morten W. Petersen wrote:
> [...]
>>> It was an example posted here IIRC, which was neat.
>>
>> Hang on, haven't we already established that your code requires C11 to
>> compile?  You stated somewhere up-thread that you value mixed
>> declaration and code (added in C99).
>
> Going further back, after discussions on this group, I found that C90
> is the way to go.
>
> I recently discovered that nesting wasn't supported in C90 when I used
> an old version of GCC.

That depends on what you mean by "nesting".  If you mean anonymous
structures, it would be a lot clearer to use that term.

Structures as members of other structures are supported in all versions
of C:

    struct outer {
        int outer_member;
        struct inner {
            int inner_member;
        } inn;
    };

Anonymous structures as members of other structures:

    struct outer {
        int outer_member;
        struct {
            int inner_member;
        };
    };

are supported only in C11 (or as an extension with some compilers).
They don't add any real new functionality, just the ability to omit
an intermediate member name when referring to the inner member.
If you have an object "obj" of type "struct outer", the second
definition lets you refer to "obj.inner_member"; with the first
you have to write "obj.inn.inner_member".

[...]

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


#75515

Fromsupercat@casperkitty.com
Date2015-11-09 13:02 -0800
Message-ID<6b11a6f3-27f4-4d58-a9f3-4a05f73813c4@googlegroups.com>
In reply to#75511
On Monday, November 9, 2015 at 2:30:42 PM UTC-6, Keith Thompson wrote:
> Anonymous structures as members of other structures:
> 
>     struct outer {
>         int outer_member;
>         struct {
>             int inner_member;
>         };
>     };
> 
> are supported only in C11 (or as an extension with some compilers).
> They don't add any real new functionality, just the ability to omit
> an intermediate member name when referring to the inner member.

In cases where it's necessary to have aliases for some fields of a type,
the ability to avoid burdening consumers of the type with an extra level
of field access for each level of nesting required by the type system
can be very useful, especially if it becomes necessary to add a level of
nesting to existing code (e.g. because a compiler insists that indirect
access to structures with shared initial members be done via union).

An even more helpful facility would be the ability to prefix a field of
a structure with a "default" keyword as an indicator that if the structure
is used in a context where there is exactly one default-tagged field that
would make the usage valid, that field will be assumed.  Thus, given:

    struct xy {int x, y;};
    struct {
      struct xy default floorpos;
      int q;
    } sample;

the compiler would regard "sample.x" as synonymous with "sample.floorpos.x",
but (unlike with anonymous structures) still allow "sample.floorpos" to be
used as an item in its own right.  I don't know of any plans to add such a
thing, though.

BTW, it's interesting that the earliest dialects of C supported this sort
of functionality for the first member of a type, albeit in a very hackish
fashion, by regarding all structures as being members of a common union.
While it's good that compilers don't generally allow structures to be
accessed using fields of other structures, it's too bad that C hasn't done
more to facilitate aliasing when it's needed.

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


#75518

FromBartC <bc@freeuk.com>
Date2015-11-09 21:35 +0000
Message-ID<n1r3fj$v50$1@dont-email.me>
In reply to#75515
On 09/11/2015 21:02, supercat@casperkitty.com wrote:

> the ability to avoid burdening consumers of the type with an extra level
> of field access for each level of nesting required by the type system
> can be very useful, especially if it becomes necessary to add a level of
> nesting to existing code (e.g. because a compiler insists that indirect
> access to structures with shared initial members be done via union).

In another language (not C), I used a simple mechanism to alias fields; 
C-style:

  struct {
     int a, b, c;
     int x @ b;
  }

This struct has 3 fields, but .b could be accessed also as .x. The alias 
could have its own type:

  struct {
     char  a[10];
     short x @a[2];
  }

Here, .x accesses a[2] and a[3] as a single short value. Now, I mainly 
use anonymous structs and unions, although it's harder to achieve some 
of the same flexibility.

> An even more helpful facility would be the ability to prefix a field of
> a structure with a "default" keyword as an indicator that if the structure
> is used in a context where there is exactly one default-tagged field that
> would make the usage valid, that field will be assumed.  Thus, given:
>
>      struct xy {int x, y;};
>      struct {
>        struct xy default floorpos;
>        int q;
>      } sample;
>
> the compiler would regard "sample.x" as synonymous with "sample.floorpos.x",
> but (unlike with anonymous structures) still allow "sample.floorpos" to be
> used as an item in its own right.  I don't know of any plans to add such a
> thing, though.

Probably a good thing. After a few minutes I still had no idea of what 
this was trying to do. But it also stops the compiler picking up error 
of using the wrong field: suppose you had objects P (an xy struct), and 
Q (a sample struct), but mistakenly wrote Q.x instead of P.x; that bug 
would get through.

Also, what happens if struct sample also has a field called "x"? More 
importantly, suppose that after you've got lots of code that uses .x on 
sample structs, that struct now acquires its own .x field? Would use of 
'default' now be an error? Trouble is that you (and possibly dozens of 
other people) how now got a pile of code that needs to be revised!

Bartc

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


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

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


csiph-web