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


Groups > comp.lang.c > #74578

Re: The C Containers library

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: The C Containers library
Date 2015-11-01 12:04 -0800
Organization None to speak of
Message-ID <lnr3k97afq.fsf@kst-u.example.com> (permalink)
References <n14lk4$hmh$1@dont-email.me>

Show all headers | View raw


jacobnavia <jacob@jacob.remcomp.fr> writes:
> I posted  yesterday a pointer to a pure C package, that allows any C 
> programmer to enjoy the samelevel of abstraction than C++. In the post 
> there were two small errors that allowed some people to just say "It 
> doesn't compile" and leave it there, even if the errors are VERY easy to 
> fix.
>
> I post again the two examples and ask for a real discussion here, 
> instead of pointing to details.
>
> The task
> --------
> You have a file with an unknown number of text lines of variable
> lengths. Read the lines and write them out sorted in another file.
>
> The C++ solution
> ------------------------------------------------------
[snip]
> int main(int argc,char* argv[])
> {
>      char* file = argv[2];    // input file name
>      char* ofile = argv[3];   // output file name
[snip]
> }
> --------------------------------------------------
>
> The C solution
>
> -------------------------------------------------
> #include <containers.h>
>
> int main(void)
> {
>      strCollection *myData =
>          istrCollection.CreateFromFile("mydata.txt");
>      istrCollection.Sort(myData);
>      istrCollection.WriteToFile(myData,"mySortedData.txt");
>      return 0;
> }
> -------------------------------------------------

Discussion would be easier if you would at least make the C++
and C solutions equivalent.

The C++ version takes the input and output file names from command
line arguments (and doesn't check whether those arguments exist).
The C version uses hardwired file names.

Yes, this is a minor detail, easily fixed, and no, I'm not commenting
on the collections library itself.  I might consider doing so if I
thought there was any chance you'd be receptive to anything I have
to say.  History suggests you would not.

> URL:
> https://code.google.com/p/ccl/
>
> The code is completely free, no strings attached.

Not true.  The code is licensed under the BSD 3-Clause License.
It is a free software license, but it does attach some strings,
including a requirement to retain the copyright notice.  A minor
detail, but IMHO an important one.

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

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


Thread

The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-01 10:24 +0100
  Re: The C Containers library Ian Collins <ian-news@hotmail.com> - 2015-11-01 22:43 +1300
    Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-01 12:08 +0100
      Re: The C Containers library Ian Collins <ian-news@hotmail.com> - 2015-11-02 10:46 +1300
        Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-01 23:10 +0100
  Re: The C Containers library gazelle@shell.xmission.com (Kenny McCormack) - 2015-11-01 10:57 +0000
  Re: The C Containers library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-01 10:57 +0000
    Re: The C Containers library Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-01 03:30 -0800
      Re: The C Containers library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-01 16:36 +0000
        Re: The C Containers library Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-01 10:04 -0800
          Re: The C Containers library Ian Collins <ian-news@hotmail.com> - 2015-11-02 07:23 +1300
            Re: The C Containers library Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-01 13:25 -0800
            Re: The C Containers library supercat@casperkitty.com - 2015-11-01 15:44 -0800
          Re: The C Containers library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-01 23:50 +0000
            Re: The C Containers library Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-02 01:19 -0800
              Re: The C Containers library Ian Collins <ian-news@hotmail.com> - 2015-11-02 22:33 +1300
                Re: The C Containers library Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-02 02:04 -0800
  Re: The C Containers library Keith Thompson <kst-u@mib.org> - 2015-11-01 12:04 -0800
    Re: The C Containers library Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-01 15:41 -0500
      Re: The C Containers library Keith Thompson <kst-u@mib.org> - 2015-11-01 13:26 -0800
        Re: The C Containers library Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-01 16:50 -0500

csiph-web