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


Groups > comp.lang.c > #90755

Re: Advantages of C

From jacobnavia <jacob@jacob.remcomp.fr>
Newsgroups comp.lang.c
Subject Re: Advantages of C
Date 2016-07-22 10:14 +0200
Organization A noiseless patient Spider
Message-ID <nmskll$n89$1@dont-email.me> (permalink)
References (3 earlier) <87mvlehbm0.fsf@bsb.me.uk> <nmjjid$tu1$1@dont-email.me> <8737n49mcg.fsf@gmail.com> <nmop5p$93s$1@dont-email.me> <0bb160af-d07c-4e8e-bd31-da4eee2d0467@googlegroups.com>

Show all headers | View raw


Le 21/07/2016 à 18:48, jadill33@gmail.com a écrit :
> On Wednesday, July 20, 2016 at 5:07:14 PM UTC-4, jacobnavia wrote:
>> Le 20/07/2016 à 20:49, Gareth Owen a écrit :
>>> jacobnavia <j...@...fr> writes:
>>>
>>>> Lisp spends an awful lot of time checking the arguments, what C
>>>> generated code doesn't do since the types are checked at compile time.
>>>
>>> ... says the man who implemented an entire container library using void*
>>> pointers and essentially no type checking.
>>>
>> If you take some time to see the CCL you will see that there is a
>> generic interface implemented with C macros, that allows you full
>> compiler type checking if you want.
>>
>> See the implementation of the generic lists and others. Of course I was
>> told that C macros are primitive and ugly, and what I wanted to do was
>> impossible to do with C macros.
>
> Hmmm, I vaguely remember seeing SGLIB before the CCL.  At least there was
> some prior art to a container library that used a macro interface.
>
Never heard of the "SGLIB". Where is it?

> The two issues with the macro version that I can see are code "ugliness"
> (depending on developer's perception of macros) and code bloat.  I'm not
> sure if there exists a purely C container macro incantation that C
> developers at large would accept (which at this time in the C standards
> lifecycle would be a precursor to getting something that the standards
> committee would debate about).  There's a lot of ingrained disdain towards
> macros (and it's not without valid reasons).
>

Well C macros aren't as ugly as other c++ constructs. "Ugly" is not a 
valid adjective here.

> For a single application, code bloat is not likely to be a problem.  You
> just declare the containers for the types you need and link them in.


Or you put the object code in a library. Only the needed functions will 
be linked in.

> However, I don't think it scales well.  If you have a suite of applications
> and you want to use the same containers generated using the macro interface,
> you have the potential to either duplicate code in each of the applications
> (e.g. app 1 and 2 uses a macro generated list of integers) or maintain some
> library of a mishmash of type specific containers that cover all of your
> applications.
>

I think you should look at c++. If you have a template, the template 
code will be replicated in all your applications ALSO. Here the 
situation  is exactly the same.

> Sounds like a maintenance nightmare to me.

You pose a non-existing problem and then bloat it like a C macro!
:-)

The void* version, while being
> less type safe, has the advantage that it can be compiled into a single
> shared library and linked against all of the applications, (with a different
> nightmare scenario, mixing up container types at runtime and summoning all
> sorts of nasal demons).
>

What a catastrophe!

With templates those catastrophes are so common that Bjarne tried 
(unsuccessfully) to figure out args checking for templates (the 
"concepts" debacle) but couldn't do it.

> It gets worse if there is a bug in the macro implementation.

Yes. See what happens when you have a bug in the template code.

Now I have
> to rebuild every application that uses that instead of just releasing a
> new shared library that contains the fix.  As an example, consider how
> one would support a MSVC C Runtime library model with standard container
> library support using the macro implementation.  I don't find it to be
> feasible.
>

????
I just do not see what the MSVC C runtime has anything to do here.

> It's nice that you make both options available.  C++ went the "macro"
> route with templates (although internally some implementations may use
> void* under the hood to avoid the code bloat problem).  From my
> perspective, it appears uncertain if any incarnation of a container
> library (macro or void*) can grab enough of a foothold to make the
> standards committee notice, especially when alternative languages with
> more "mature" container implementations exist (and a large number of
> people here point their finger in that direction).  If you can't win
> over comp.lang.c, I don't see how the standards committee is going to
> be any different.
>

Yeah c++ makes everything better. I know the story.

> It's great that you've contributed to the C community with your container
> library.  It's a success just releasing it out there.  That's all that
> you can control; the rest is just part of the adventure of seeing where it
> goes.
>
> Best regards,
> John D.
>

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-18 17:02 +0200
  Re: Advantages of C BartC <bc@freeuk.com> - 2016-07-18 16:16 +0100
    Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-18 19:13 +0200
    Re: Advantages of C Udyant Wig <udyant.wig@gmail.com> - 2016-07-18 23:56 +0530
  Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 08:17 -0700
    Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-18 17:38 +0200
  Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 16:48 +0100
    Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-18 17:58 +0200
      Re: Advantages of C Richard Heathfield <rjh@cpax.org.uk> - 2016-07-18 17:27 +0100
        Re: Advantages of C Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-18 15:19 -0400
        Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 21:49 +0100
          Re: Advantages of C Richard Heathfield <rjh@cpax.org.uk> - 2016-07-18 22:06 +0100
            Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 01:11 +0100
              Re: Advantages of C Richard Heathfield <rjh@cpax.org.uk> - 2016-07-19 01:31 +0100
                Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 02:29 +0100
                Re: Advantages of C Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-18 21:58 -0400
          Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 16:30 -0700
            Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 02:06 +0100
              Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 19:39 -0700
                Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 15:29 +0100
                Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-19 07:39 -0700
                Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 17:19 +0100
        Re: Advantages of C luser droog <luser.droog@gmail.com> - 2016-07-18 21:16 -0700
      Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 22:47 +0100
        Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 16:48 -0700
      Re: Advantages of C Ian Collins <ian-news@hotmail.com> - 2016-07-19 10:21 +1200
        Re: Advantages of C raltbos@xs4all.nl (Richard Bos) - 2016-07-23 19:43 +0000
    Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-18 18:05 +0200
      Re: Advantages of C Jean-Marc Bourguet <jm@bourguet.org> - 2016-07-18 21:45 +0200
        Re: Advantages of C BartC <bc@freeuk.com> - 2016-07-18 21:16 +0100
          Re: Advantages of C Udyant Wig <udyant.wig@gmail.com> - 2016-07-19 11:00 +0530
            Re: Advantages of C BartC <bc@freeuk.com> - 2016-07-19 11:00 +0100
              Re: Advantages of C Udyant Wig <udyant.wig@gmail.com> - 2016-07-20 10:08 +0530
        Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-18 23:32 +0200
          Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 16:54 -0700
            Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 01:54 +0100
              Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 20:02 -0700
                Re: Advantages of C Udyant Wig <udyant.wig@gmail.com> - 2016-07-19 11:26 +0530
                Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-19 01:43 -0700
                Re: Advantages of C Udyant Wig <udyant.wig@gmail.com> - 2016-07-20 10:33 +0530
                Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-20 01:07 -0700
                Re: Advantages of C Udyant Wig <udyant.wig@gmail.com> - 2016-07-21 12:53 +0530
                Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 15:33 +0100
                Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-19 08:04 -0700
                Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 17:35 +0100
              Re: Advantages of C Gareth Owen <gwowen@gmail.com> - 2016-07-19 19:21 +0100
          Re: Advantages of C Jean-Marc Bourguet <jm@bourguet.org> - 2016-07-20 12:05 +0200
        Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 16:51 -0700
          Re: Advantages of C raltbos@xs4all.nl (Richard Bos) - 2016-07-23 09:24 +0000
            Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-23 02:33 -0700
      Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 22:36 +0100
        Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-19 00:00 +0200
          Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 01:46 +0100
          Re: Advantages of C Gareth Owen <gwowen@gmail.com> - 2016-07-20 19:49 +0100
            Re: Advantages of C supercat@casperkitty.com - 2016-07-20 12:02 -0700
              Re: Advantages of C Keith Thompson <kst-u@mib.org> - 2016-07-20 12:32 -0700
                Re: Advantages of C supercat@casperkitty.com - 2016-07-20 13:18 -0700
              Re: Advantages of C Gareth Owen <gwowen@gmail.com> - 2016-07-20 20:37 +0100
            Re: Advantages of C jadill33@gmail.com - 2016-07-20 13:06 -0700
            Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-20 23:07 +0200
              Re: Advantages of C jadill33@gmail.com - 2016-07-21 09:48 -0700
                Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-22 10:14 +0200
                Re: Advantages of C Ian Collins <ian-news@hotmail.com> - 2016-07-22 20:25 +1200
                Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-22 02:17 -0700
                Re: Advantages of C Ian Collins <ian-news@hotmail.com> - 2016-07-22 23:56 +1200
                Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-22 11:28 +0200
                Re: Advantages of C Ian Collins <ian-news@hotmail.com> - 2016-07-22 23:49 +1200
                Re: Advantages of C jadill33@gmail.com - 2016-07-22 06:46 -0700
        Re: Advantages of C BartC <bc@freeuk.com> - 2016-07-18 23:13 +0100
          Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-19 01:45 +0100
    Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-18 19:18 +0200
      Re: Advantages of C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 22:47 +0100
        Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-19 00:07 +0200
          Re: Advantages of C Melzzzzz <mel@zzzzz.com> - 2016-07-19 00:18 +0200
            Re: Advantages of C jacobnavia <jacob@jacob.remcomp.fr> - 2016-07-19 01:36 +0200
          Re: Advantages of C Ian Collins <ian-news@hotmail.com> - 2016-07-19 10:28 +1200
            Re: Advantages of C Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-18 20:34 -0400
          Re: Advantages of C Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-18 20:33 -0400
            Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 19:30 -0700
        Re: Advantages of C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-07-18 17:01 -0700
  Re: Advantages of C Udyant Wig <udyant.wig@gmail.com> - 2016-07-18 23:51 +0530
    Re: Advantages of C Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-20 09:01 -0700

csiph-web