Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: CCL vs STL: a comparison |
| Date | 2012-05-12 20:09 +1200 |
| Message-ID | <a16k51Fa8uU2@mid.individual.net> (permalink) |
| References | (1 earlier) <0.81abe602485ae4e38c44.20120511203101BST.87boluwm4q.fsf@bsb.me.uk> <jojrg3$66s$2@speranza.aioe.org> <a15br0F58bU1@mid.individual.net> <87ehqpj51g.fsf@gmail.com> <jol4jh$tpt$1@speranza.aioe.org> |
On 05/12/12 07:48 PM, jacob navia wrote:
> Le 12/05/12 08:18, Gareth Owen a écrit :
>> Ian Collins<ian-news@hotmail.com> writes:
>>
>>> On 05/12/12 08:06 AM, jacob navia wrote:
>>>> Le 11/05/12 21:31, Ben Bacarisse a écrit :
>>>>> I am not sure what you are really asking.
>>>>
>>>> Just trying to discuss the two approaches. I am sure
>>>> C++ has more "syntactic sugar" than C, but the
>>>> two approaches lead to similar code.
>>>
>>> Not really. As Ben demonstrated, the "syntactic sugar" leads to much
>>> more concise and less error prone code. In this case, 2 lines rather
>>> than 18!
>>
>> Jacob's code contains an explicit cast of a void* to an int*, meaning
>> the programmer has to track the data types and then tell the compiler
>> what they are, rather than have the compiler track and check the types.
>>
>> He doesn't seem to believe this to be a drawback.
>>
>> Describing the C++ as "less error prone" would be something of an
>> understatement.
>
> Yes. C++ is the best thing since sliced bread.
Did anyone here make that claim?
> In C, the programmer has to do more work. But he gains more control
> of what is going on, and avoids a complex (and more error prone yes)
> language.
Kindly explain (I bet you won't) how
List *L;
int data;
L = iList.Create(sizeof(int));
data = 0;
iList.Add(L,&data);
iList.PushFront(L,&data);
data = 2;
iList.InsertAt(L,1,&data);
data = 5;
iList.Add(L,&data);
data = 6;
iList.Add(L,&data);
iList.Apply(L,PrintInt,stdout);
iList.Finalize(L);
gives the user more control and is less error prone than than
list<int> L = {0, 2, 0, 5, 6};
As I've said many times, the complexity in a given problem is fixed,
where it occurs (in the language or in the code) is variable.
It's worth noting that most of the C++ improvements Ben introduced use
new C++ features. This is because a large proportion of the new
features in C++11 were added to make the programmer's job easier. It's
a pity C11 didn't set out with the same objective.
> It is my personal view, that is why I insist in developing in C. You
> are entitled to your opinion of course. But I thought that in a C group
> we would discuss how to improve C.
Well that's a bit rich considering it was you who introduced the comparison!
> What would you propose? (Besides the obvious "Use C++")
Use the best tool for the job, which doesn't have to be C or C++.
--
Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-11 18:59 +0200
Re: CCL vs STL: a comparison Ike Naar <ike@sverige.freeshell.org> - 2012-05-11 17:54 +0000
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-11 19:59 +0200
Re: CCL vs STL: a comparison Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-11 20:31 +0100
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-11 21:56 +0200
Re: CCL vs STL: a comparison Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-11 21:02 +0100
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-11 22:12 +0200
Re: CCL vs STL: a comparison Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-11 21:18 +0100
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-11 22:01 +0200
Re: CCL vs STL: a comparison Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-11 21:08 +0100
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-11 22:04 +0200
Re: CCL vs STL: a comparison Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-11 21:11 +0100
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-11 22:15 +0200
Re: CCL vs STL: a comparison cartec69@gmail.com - 2012-05-11 13:17 -0700
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-11 22:06 +0200
Re: CCL vs STL: a comparison Ian Collins <ian-news@hotmail.com> - 2012-05-12 08:41 +1200
Re: CCL vs STL: a comparison Gareth Owen <gwowen@gmail.com> - 2012-05-12 07:18 +0100
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-12 09:48 +0200
Re: CCL vs STL: a comparison Ian Collins <ian-news@hotmail.com> - 2012-05-12 20:09 +1200
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-12 10:30 +0200
Re: CCL vs STL: a comparison Ian Collins <ian-news@hotmail.com> - 2012-05-12 21:23 +1200
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-12 11:39 +0200
Re: CCL vs STL: a comparison Ian Collins <ian-news@hotmail.com> - 2012-05-12 23:02 +1200
Re: CCL vs STL: a comparison "BartC" <bc@freeuk.com> - 2012-05-12 13:14 +0100
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-12 14:35 +0200
Re: CCL vs STL: a comparison "io_x" <a@b.c.invalid> - 2012-05-13 10:59 +0200
Re: CCL vs STL: a comparison "BartC" <bc@freeuk.com> - 2012-05-11 23:36 +0100
Re: CCL vs STL: a comparison Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-12 00:25 +0100
Re: CCL vs STL: a comparison Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-12 01:58 +0100
Re: CCL vs STL: a comparison Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-11 19:30 -0700
Re: CCL vs STL: a comparison jacob navia <jacob@spamsink.net> - 2012-05-12 09:49 +0200
Re: CCL vs STL: a comparison Jens Gustedt <jens.gustedt@loria.fr> - 2012-05-12 18:31 +0200
csiph-web