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


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

Is there any place to talk about language features?

Started byThiago Adams <thiago.adams@gmail.com>
First post2016-09-28 09:35 -0700
Last post2016-09-28 20:20 +0100
Articles 15 on this page of 135 — 24 participants

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


Contents

  Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 09:35 -0700
    Re: Is there any place to talk about language features? Keith Thompson <kst-u@mib.org> - 2016-09-28 09:39 -0700
      Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 09:46 -0700
        Re: Is there any place to talk about language features? Richard Heathfield <rjh@cpax.org.uk> - 2016-09-28 17:53 +0100
        Re: Is there any place to talk about language features? David Brown <david.brown@hesbynett.no> - 2016-09-28 21:21 +0200
        Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-09-28 20:36 +0100
          Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 13:55 -0700
            Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 14:02 -0700
            Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-09-29 10:03 +1300
              Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 14:13 -0700
                Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-09-29 10:22 +1300
                  Re: Is there any place to talk about language features? Robert Latest <boblatest@yahoo.com> - 2016-10-03 08:47 +0000
                    Re: Is there any place to talk about language features? James Kuyper <jameskuyper@verizon.net> - 2016-10-03 07:44 -0400
                      Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-03 04:56 -0700
                        Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-10-03 13:18 +0100
                          Re: Is there any place to talk about language features? BGB <cr88192@hotmail.com> - 2016-10-03 12:43 -0500
                            Re: Is there any place to talk about language features? Ike Naar <ike@iceland.freeshell.org> - 2016-10-03 21:43 +0000
                              Re: Is there any place to talk about language features? John Gordon <gordon@panix.com> - 2016-10-03 22:28 +0000
                    Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-10-03 04:51 -0700
                      Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-10-03 13:10 +0100
                        Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-03 05:48 -0700
                          Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-10-03 14:03 +0100
                            Re: Is there any place to talk about language features? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-03 14:24 +0100
                              Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-03 07:07 -0700
                                Re: Is there any place to talk about language features? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-03 19:16 +0100
                            Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-03 07:16 -0700
                              Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-03 07:45 -0700
                              Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-03 07:57 -0700
                      Re: Is there any place to talk about language features? James Kuyper <jameskuyper@verizon.net> - 2016-10-03 08:21 -0400
                        Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-10-03 05:31 -0700
                        Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-03 06:43 -0700
                    Re: Is there any place to talk about language features? David Brown <david.brown@hesbynett.no> - 2016-10-03 15:08 +0200
                Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 14:22 -0700
                  Re: Is there any place to talk about language features? Keith Thompson <kst-u@mib.org> - 2016-09-28 15:16 -0700
                    Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 16:08 -0700
                      Re: Is there any place to talk about language features? Keith Thompson <kst-u@mib.org> - 2016-09-28 16:57 -0700
            Re: Is there any place to talk about language features? Keith Thompson <kst-u@mib.org> - 2016-09-28 14:19 -0700
              Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 14:50 -0700
                Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 17:03 -0700
                Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-09-29 01:08 +0100
                  Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-28 17:33 -0700
                    Re: Is there any place to talk about language features? Melzzzzz <Melzzzzz@zzzzz.com> - 2016-09-29 01:02 +0000
                      Re: Is there any place to talk about language features? BGB <cr88192@hotmail.com> - 2016-09-29 01:39 -0500
                        Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-29 00:48 -0700
                          Re: Is there any place to talk about language features? BGB <cr88192@hotmail.com> - 2016-09-29 11:59 -0500
                          Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-01 08:09 +1300
                            Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-30 12:14 -0700
                              Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-01 09:07 +1300
                                Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-30 13:53 -0700
                                  Re: Is there any place to talk about language features? Gareth Owen <gwowen@gmail.com> - 2016-09-30 22:13 +0100
                                    Re: Is there any place to talk about language features? raltbos@xs4all.nl (Richard Bos) - 2016-10-01 09:36 +0000
                                      Re: Is there any place to talk about language features? Jerry Stuckle <jstucklex@attglobal.net> - 2016-10-01 13:04 -0400
                                  Re: Is there any place to talk about language features? "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-09-30 14:20 -0700
                                  Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-09-30 22:30 +0100
                                Re: Is there any place to talk about language features? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2016-10-02 07:30 +0000
                            Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-01 01:51 -0700
                              Re: Is there any place to talk about language features? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-01 10:31 +0100
                              Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-01 23:22 +1300
                                Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-01 06:15 -0700
                                  Re: Is there any place to talk about language features? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-01 15:28 +0100
                                    Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-01 10:07 -0700
                                      Re: Is there any place to talk about language features? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-01 19:52 +0100
                                  Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-02 20:38 +1300
                                    Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-02 03:37 -0700
                                      Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-03 08:35 +1300
                                        Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-02 15:17 -0700
                                          Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-03 18:29 +1300
                                            Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-03 01:09 -0700
                                              Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-04 08:21 +1300
                                                Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-03 13:12 -0700
                                                  Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-03 14:34 -0700
                                                    Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-04 00:47 -0700
                                                    Re: Is there any place to talk about language features? Ike Naar <ike@iceland.freeshell.org> - 2016-10-04 07:49 +0000
                                                      Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-04 07:50 -0700
                                                        Re: Is there any place to talk about language features? Keith Thompson <kst-u@mib.org> - 2016-10-04 08:57 -0700
                                                          Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-04 10:42 -0700
                                                  Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-05 15:47 +1300
                                                    Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-04 20:58 -0700
                                                      Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-05 18:14 +1300
                                                        Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-05 02:15 -0700
                                                          Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-05 22:44 +1300
                                                            Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-05 03:12 -0700
                                                              Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-06 15:38 +1300
                                                                Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-05 19:50 -0700
                                                                  Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-06 16:25 +1300
                                                                    Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-05 21:19 -0700
                                                                      Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-06 18:11 +1300
                                                                        Re: Is there any place to talk about language features? Gareth Owen <gwowen@gmail.com> - 2016-10-06 06:38 +0100
                                                                        Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-06 00:36 -0700
                                                                          Re: Is there any place to talk about language features? gwowen <gwowen@gmail.com> - 2016-10-06 07:33 -0700
                                                                            Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-06 09:00 -0700
                                                                              Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-07 00:32 -0700
                                                                                Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-10-07 05:05 -0700
                                                                                  Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-07 08:13 -0700
                                                                            Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-07 00:20 -0700
                                                                              Re: Is there any place to talk about language features? Gareth Owen <gwowen@gmail.com> - 2016-10-07 17:01 +0100
                                                            Re: Is there any place to talk about language features? Les Cargill <lcargill99@comcast.com> - 2016-10-05 12:45 -0500
                                                          Re: Is there any place to talk about language features? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-05 11:12 +0100
                                                            Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-05 03:15 -0700
                                                              Re: Is there any place to talk about language features? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-05 14:41 +0100
                                                                Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-05 08:01 -0700
                                                                  Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-05 08:41 -0700
                                                                    Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-05 10:29 -0700
                                                    Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-10-05 12:29 -0700
                                            Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-10-05 11:08 +0100
                                              Re: Is there any place to talk about language features? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-05 14:35 +0100
                                                Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-10-05 18:15 +0100
                                                  Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-05 10:38 -0700
                                                    Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-10-05 19:14 +0100
                                                      Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-05 11:56 -0700
                                                    Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-10-05 11:57 -0700
                                                      Re: Is there any place to talk about language features? Keith Thompson <kst-u@mib.org> - 2016-10-05 12:18 -0700
                                                        Re: Is there any place to talk about language features? David Brown <david.brown@hesbynett.no> - 2016-10-05 21:49 +0200
                                                          Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-10-05 13:07 -0700
                                                          Re: Is there any place to talk about language features? "James R. Kuyper" <jameskuyper@verizon.net> - 2016-10-05 16:23 -0400
                                                            Re: Is there any place to talk about language features? David Brown <david.brown@hesbynett.no> - 2016-10-06 14:26 +0200
                                                        Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-05 13:56 -0700
                                                        Re: Is there any place to talk about language features? BartC <bc@freeuk.com> - 2016-10-06 14:17 +0100
                                                          Re: Is there any place to talk about language features? David Brown <david.brown@hesbynett.no> - 2016-10-06 15:53 +0200
                                                          Re: Is there any place to talk about language features? Keith Thompson <kst-u@mib.org> - 2016-10-06 09:12 -0700
                                                            Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-06 11:28 -0700
                                              Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-06 15:31 +1300
                                                Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-06 15:32 +1300
                                                Re: Is there any place to talk about language features? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-10-05 19:43 -0700
                                                  Re: Is there any place to talk about language features? Ian Collins <ian-news@hotmail.com> - 2016-10-06 16:05 +1300
                          Re: Is there any place to talk about language features? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2016-10-02 07:24 +0000
                        Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-09-30 16:17 -0700
                          Re: Is there any place to talk about language features? raltbos@xs4all.nl (Richard Bos) - 2016-10-01 09:39 +0000
                            Re: Is there any place to talk about language features? supercat@casperkitty.com - 2016-10-01 14:11 -0700
              Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-29 07:47 -0700
              Re: Is there any place to talk about language features? Thiago Adams <thiago.adams@gmail.com> - 2016-09-29 10:25 -0700
    Re: Is there any place to talk about language features? "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-28 12:59 -0400
      Re: Is there any place to talk about language features? Richard Heathfield <rjh@cpax.org.uk> - 2016-09-28 18:30 +0100
        Re: Is there any place to talk about language features? Keith Thompson <kst-u@mib.org> - 2016-09-28 12:10 -0700
      Re: Is there any place to talk about language features? James Harris <james.harris.1@gmail.com> - 2016-09-28 20:20 +0100

Page 7 of 7 — ← Prev page 1 2 3 4 5 6 [7]


#94542

Fromsupercat@casperkitty.com
Date2016-10-06 11:28 -0700
Message-ID<131b7ee1-0240-477d-961c-7583a639c2f0@googlegroups.com>
In reply to#94538
On Thursday, October 6, 2016 at 11:12:09 AM UTC-5, Keith Thompson wrote:
> Of course that's true, and of course gcc or any other compiler
> *could* optimize printf("%d\n", 42) to the equivalent of puts("42").
> 
> My speculation is that, even considering the cases where the
> argument is not a constant but some expression that can be
> evaluated at compile time, it just hasn't been considered worth
> the effort to implement that particular optimization.  There's no
> fundamental principle at work here, just a tradeoff of effort.
> I wouldn't be astonished to see a future version of gcc do this
> optimization, perhaps just because some developer thought it would
> be an interesting thing to implement.

Whether such a thing is actually an optimization would depend upon
whether other parts of the code require a more "general" printf, and
also upon whether "puts" would be needed on the target otherwise.

If a compiler, linker, and library were produced together as a complete
implementation, a compiler could define some special symbols when it sees
a call to "printf" with various kinds of format, or when it sees a call
with a format it can't classify (e.g. because it's not a compile-time
constant), and the linker could then load a version of "printf" which will
satisfy the application's needs.  In such a system, there would be no real
benefit to having a compiler replace printf with "puts" because such a
substitution would happen at the linker if all calls can be replaced, and
if a full-featured printf is needed for any purpose, it may as well be used
everywhere rather than having bundling simpler output routines *in addition*
to the full printf.

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


#94510

FromIan Collins <ian-news@hotmail.com>
Date2016-10-06 15:31 +1300
Message-ID<e5lrc2Fki0fU1@mid.individual.net>
In reply to#94472
On 10/ 5/16 11:08 PM, BartC wrote:
> On 03/10/2016 06:29, Ian Collins wrote:
>> On 10/ 3/16 11:17 AM, Malcolm McLean wrote:
>>> On Sunday, October 2, 2016 at 8:35:27 PM UTC+1, Ian Collins wrote:
>>>>
>>>> So you see the pattern of more and more complexity creeping into the
>>>> application code?
>>>>
>>> Not really.
>>
>> So you don't see each of your solutions becoming steadily more complex?
>
> You make it sound as though writing this stuff in C++ makes everything
> beautifully clean, clear and concise. But the C++ code I've seen is
> anything but that!

Thin this particular context (resource management) it certainly is easier.

-- 
Ian

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


#94512

FromIan Collins <ian-news@hotmail.com>
Date2016-10-06 15:32 +1300
Message-ID<e5lrdhFki0fU2@mid.individual.net>
In reply to#94510
On 10/ 6/16 03:31 PM, Ian Collins wrote:
> On 10/ 5/16 11:08 PM, BartC wrote:
>> On 03/10/2016 06:29, Ian Collins wrote:
>>> On 10/ 3/16 11:17 AM, Malcolm McLean wrote:
>>>> On Sunday, October 2, 2016 at 8:35:27 PM UTC+1, Ian Collins wrote:
>>>>>
>>>>> So you see the pattern of more and more complexity creeping into the
>>>>> application code?
>>>>>
>>>> Not really.
>>>
>>> So you don't see each of your solutions becoming steadily more complex?
>>
>> You make it sound as though writing this stuff in C++ makes everything
>> beautifully clean, clear and concise. But the C++ code I've seen is
>> anything but that!
>
> Thin this particular context (resource management) it certainly is easier.

Thin?  In!

-- 
Ian

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


#94515

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2016-10-05 19:43 -0700
Message-ID<42fc4e87-810c-4af9-8e7e-e559b36cd142@googlegroups.com>
In reply to#94510
On Thursday, October 6, 2016 at 3:31:38 AM UTC+1, Ian Collins wrote:
> On 10/ 5/16 11:08 PM, BartC wrote:
> > On 03/10/2016 06:29, Ian Collins wrote:
> >> On 10/ 3/16 11:17 AM, Malcolm McLean wrote:
> >>> On Sunday, October 2, 2016 at 8:35:27 PM UTC+1, Ian Collins wrote:
> >>>>
> >>>> So you see the pattern of more and more complexity creeping into the
> >>>> application code?
> >>>>
> >>> Not really.
> >>
> >> So you don't see each of your solutions becoming steadily more complex?
> >
> > You make it sound as though writing this stuff in C++ makes everything
> > beautifully clean, clear and concise. But the C++ code I've seen is
> > anything but that!
> 
> Thin this particular context (resource management) it certainly is easier.
> 
C++ allows a destructor to be called automatically. Essentially that's
the only facility that C++ offers which cannot be emulated by local
changes in C. (Other than template meta-programming, but that's another
story).
There are some benefits, and on the whole, if you stick rigidly to a
pattern of only using STL members, you don't have to actually write
the destructors, and it is easier. But where does it break down?
The answer is graphs. STL has a set (balanced binary search tree) and
an unordered set (hash table), which are common graphs and handy,
but you can't easily extend STL to arbitrary graphs. And that's also
exactly the same place where my system starts to develop difficulties.

And for essentially the same reason, because the underlying ideas and
mechanisms are the same. It's mainly a matter of hiding things versus
making them explicit.

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


#94517

FromIan Collins <ian-news@hotmail.com>
Date2016-10-06 16:05 +1300
Message-ID<e5ltbrFkjf8U1@mid.individual.net>
In reply to#94515
On 10/ 6/16 03:43 PM, Malcolm McLean wrote:
> On Thursday, October 6, 2016 at 3:31:38 AM UTC+1, Ian Collins wrote:
>> On 10/ 5/16 11:08 PM, BartC wrote:
>>> On 03/10/2016 06:29, Ian Collins wrote:
>>>> On 10/ 3/16 11:17 AM, Malcolm McLean wrote:
>>>>> On Sunday, October 2, 2016 at 8:35:27 PM UTC+1, Ian Collins wrote:
>>>>>>
>>>>>> So you see the pattern of more and more complexity creeping into the
>>>>>> application code?
>>>>>>
>>>>> Not really.
>>>>
>>>> So you don't see each of your solutions becoming steadily more complex?
>>>
>>> You make it sound as though writing this stuff in C++ makes everything
>>> beautifully clean, clear and concise. But the C++ code I've seen is
>>> anything but that!
>>
>> Thin this particular context (resource management) it certainly is easier.
>>
> C++ allows a destructor to be called automatically. Essentially that's
> the only facility that C++ offers which cannot be emulated by local
> changes in C. (Other than template meta-programming, but that's another
> story).

It is, yes.  It is also one thing I really miss on my current project 
when I swap from user space (C++) to kernel (C).  Given the scarcity of 
resources in the kernel, which make failure to acquire more common, it 
would be a really useful feature to have.

> There are some benefits, and on the whole, if you stick rigidly to a
> pattern of only using STL members, you don't have to actually write
> the destructors, and it is easier.

You are conflating containers with what is contained.  A class that 
manages a resource will need a destructor to free the resource.

> But where does it break down?
> The answer is graphs. STL has a set (balanced binary search tree) and
> an unordered set (hash table), which are common graphs and handy,
> but you can't easily extend STL to arbitrary graphs. And that's also
> exactly the same place where my system starts to develop difficulties.

Closures are often cited as a problem with RAII and it certainly pays to 
be aware of them.

> And for essentially the same reason, because the underlying ideas and
> mechanisms are the same. It's mainly a matter of hiding things versus
> making them explicit.

Or automated versus manual management, which I read as test once or test 
many times!

-- 
Ian

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


#94393

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2016-10-02 07:24 +0000
Message-ID<slrnnv1dgp.5q5.grahn+nntp@frailea.sa.invalid>
In reply to#94236
On Thu, 2016-09-29, Malcolm McLean wrote:
...
> The problem as I see it with C++ is that each new feature creates
> difficulties or hard to answer questions, which necessitate another
> feature.
> For example how is a constructor to fail? The answer is to throw
> an exception. Then how is the stack to be unwound? By calling
> implicit destructors. But how do you make sure that your object
> is in a  destructible state? By allowing memberwise initialisation
> before the constructor is actually executed.

> How do you make sure
> that the members can be initialised? With default constructors.
> But how do allow the default constructor to fail? It can't, you
> should make it "no throw".

That part seems a bit off.  It's destructors which cannot throw.

> And so it goes on.

It doesn't, IMO.  You described very accurately how constructors,
destructors and exceptions cooperate in C++.  But that part of the
language has been stable since the mid-1990s; it's not really affected
by anything that happened since, and it's not a gradual patchwork[1].

/Jorgen

[1] Well, I suppose constructors and destructors came before
    exceptions, but that happened back in the 1980s.

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

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


#94342

Fromsupercat@casperkitty.com
Date2016-09-30 16:17 -0700
Message-ID<f23c3ed5-c1b0-4018-9ef3-2ea0da2dd4ac@googlegroups.com>
In reply to#94235
On Thursday, September 29, 2016 at 1:39:51 AM UTC-5, BGB wrote:
> FWIW: it is sometimes useful to distinguish between "the core thing" and 
> "the thing with lots of extensions".

If a feature or behavioral guarantee was supported by every quality
C implementation for platform X prior to C89, and was supported by
early C89 compilers for that platform, should the authors of those
compilers have regarded such a feature or guarantee as an "extension",
or merely as a natural part of "C89 for platform X"?

What terminology should one use to describe the resulting language, to
distinguish it from a C89 implementation which targets platform X but
strips out any useful features the platform might have offered but for
which the Standard does not mandate support?

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


#94358

Fromraltbos@xs4all.nl (Richard Bos)
Date2016-10-01 09:39 +0000
Message-ID<57ef842f.357234@news.xs4all.nl>
In reply to#94342
supercat@casperkitty.com wrote:

> On Thursday, September 29, 2016 at 1:39:51 AM UTC-5, BGB wrote:
> > FWIW: it is sometimes useful to distinguish between "the core thing" and 
> > "the thing with lots of extensions".
> 
> If a feature or behavioral guarantee was supported by every quality
> C implementation for platform X prior to C89,

_If_.

[Citation needed].

Richard

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


#94379

Fromsupercat@casperkitty.com
Date2016-10-01 14:11 -0700
Message-ID<6c582aa8-5ac2-4b4b-85de-846e57dcb3e8@googlegroups.com>
In reply to#94358
On Saturday, October 1, 2016 at 4:39:21 AM UTC-5, Richard Bos wrote:
> supercat wrote:
> > If a feature or behavioral guarantee was supported by every quality
> > C implementation for platform X prior to C89,
> 
> _If_.
> 
> [Citation needed].

As I have said before, what would make the claim true would be a lack of
counter-examples.  I know of no counter-examples, but would be interested
to know of any for removely-common platforms.  Emulators are available for
many vintage platforms, and I'd be interested in knowing of the earliest
identifiable compilers for two's-complement silent-wraparound hardware
which, when not explicitly configured to do things like trap overflows,
would do anything weird if two signed values whose arithmetical product
is between INT_MAX+1 and UINT_MAX are multiplied and stored into an
unsigned variable.

I would also be interested in the earliest identifiable compiler in which
using a pointer of one structure type to access a member of the common
initial sequence of a structure of a different type would not be 100%
reliable.  I would further be interested to know of the earliest compilers
that will fail to recognize aliasing in cases where a pointer of type T1*
is cast to T2*, and all uses of the pointer resulting from the cast occur
before the next time the object is accessed as a T1.

Note that much of the purpose of C centers around the fact that even a
rather simple compiler can allow a programmer to generate efficient code,
and on many platforms compilers would have to go out of their way *not* to
behave in what I claim was the commonplace fashion.

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


#94240

FromThiago Adams <thiago.adams@gmail.com>
Date2016-09-29 07:47 -0700
Message-ID<1e6426d7-ec16-4a20-8b14-f24755a6657b@googlegroups.com>
In reply to#94221
On Wednesday, September 28, 2016 at 6:19:03 PM UTC-3, Keith Thompson wrote:
> Thiago Adams writes:
> [...]
> > The feature I am thinking about is "default initializers"
> >
> > Today we can do:
> >
> > struct Point {   int x;   int y; };
> > struct Point pt1 = { 1,  2 };
> >
> > and this is useful when the initialization change by instance basis.
> > But, for some types the initialization is the same or it have common
> > initiation part for all instances.  To avoid specify the common
> > initialization everywhere the solution is create a macro.
> >
> > struct Z { int type; };
> > #define Z_INIT { 4 }
> >
> > struct Z z1 = Z_INIT;
> 
> A minor point: this can be done without a macro:
> 
>     struct Z { int type; };
>     const struct Z Z_INIT = { 4 };
>     struct Z z1 = Z_INIT;
> 

Without a macro we lose the ability to compose

struct Point { int x; int y; };
#define POINT_INIT { 0, 0 }
const struct Point POINT_INIT2 = { 0.0 };

struct Line
{
  struct Point start;
  struct Point end;  
};
#define LINE_INIT { POINT_INIT, POINT_INIT } //ok
const struct Line LINE_INIT2 = { POINT_INIT2, POINT_INIT2 }; //ERROR

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


#94255

FromThiago Adams <thiago.adams@gmail.com>
Date2016-09-29 10:25 -0700
Message-ID<99af6019-8afe-4c0b-9661-568ac89b2dbd@googlegroups.com>
In reply to#94221
On Wednesday, September 28, 2016 at 6:19:03 PM UTC-3, Keith Thompson wrote:
> (comp.std.c might be a more appropriate place for this, but IMHO
> comp.lang.c is ok.)
> 

I post (moved) the suggestion to comp.std.c.
Sorry for double post. Already have some nice suggestion there as well.

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


#94198

From"James R. Kuyper" <jameskuyper@verizon.net>
Date2016-09-28 12:59 -0400
Message-ID<4bd1e59b-f0bf-5839-8a66-81057034aeaf@verizon.net>
In reply to#94192
Thiago Adams <thiago.adams@gmail.com> writes:
> Does C have an special usergroup/site to talk about language features?

comp.lang.c is perfectly fine location to discuss the features of the C 
language. It would even be an appropriate place to compare the features 
of C to the features of some other language.

If you wish to discuss possible new features of C, comp.std.c is the 
more appropriate location.

If you wish to discuss language features in general, without any 
particular reference to C, it should not be done in either of these 
forums. I'm sure there's a suitable forum for such a discussion, but I 
don't know enough about such things to recommend one.

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


#94201

FromRichard Heathfield <rjh@cpax.org.uk>
Date2016-09-28 18:30 +0100
Message-ID<nsgumf$kfq$1@dont-email.me>
In reply to#94198
On 28/09/16 17:59, James R. Kuyper wrote:
> Thiago Adams <thiago.adams@gmail.com> writes:
>> Does C have an special usergroup/site to talk about language features?
>
> comp.lang.c is perfectly fine location to discuss the features of the C
> language. It would even be an appropriate place to compare the features
> of C to the features of some other language.
>
> If you wish to discuss possible new features of C, comp.std.c is the
> more appropriate location.
>
> If you wish to discuss language features in general, without any
> particular reference to C, it should not be done in either of these
> forums. I'm sure there's a suitable forum for such a discussion, but I
> don't know enough about such things to recommend one.

comp.programming is a possibility.

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


#94208

FromKeith Thompson <kst-u@mib.org>
Date2016-09-28 12:10 -0700
Message-ID<lnfuojsuvg.fsf@kst-u.example.com>
In reply to#94201
Richard Heathfield <rjh@cpax.org.uk> writes:
> On 28/09/16 17:59, James R. Kuyper wrote:
>> Thiago Adams <thiago.adams@gmail.com> writes:
>>> Does C have an special usergroup/site to talk about language features?
>>
>> comp.lang.c is perfectly fine location to discuss the features of the C
>> language. It would even be an appropriate place to compare the features
>> of C to the features of some other language.
>>
>> If you wish to discuss possible new features of C, comp.std.c is the
>> more appropriate location.
>>
>> If you wish to discuss language features in general, without any
>> particular reference to C, it should not be done in either of these
>> forums. I'm sure there's a suitable forum for such a discussion, but I
>> don't know enough about such things to recommend one.
>
> comp.programming is a possibility.

So is comp.lang.misc.

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


#94210

FromJames Harris <james.harris.1@gmail.com>
Date2016-09-28 20:20 +0100
Message-ID<nsh56l$gv1$1@dont-email.me>
In reply to#94198
On 28/09/2016 17:59, James R. Kuyper wrote:
> Thiago Adams <thiago.adams@gmail.com> writes:

>> Does C have an special usergroup/site to talk about language features?

...

> If you wish to discuss language features in general, without any
> particular reference to C, it should not be done in either of these
> forums. I'm sure there's a suitable forum for such a discussion,

Newsgroup comp.lang.misc is for programming languages not discussed 
elsewhere, including embryonic ones and features thereof, though it has 
been quiet lately.

-- 
James Harris

[toc] | [prev] | [standalone]


Page 7 of 7 — ← Prev page 1 2 3 4 5 6 [7]

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


csiph-web