Re: C needs a BOOST



Stan Milam wrote:
user923005 wrote:
It would be really nice if C could adopt a really nice algorithms
library like C++'s STL + BOOST.

The recent "reverse the words in this sentence" problem posted made me
think about it.
It's like 5 lines to do it in C++ because of all the nifty algorithms
that come with the language (I think BOOST is going to get bolted on
to the C++ language like STL did).

It's a lot more work in C than C++. Why doesn't C have stacks,
dequeues, and other common, simple tool sets already in its standard
library?

Opinions? Is keeping the language tiny worth the cost of C
programmers having to constantly reinvent the wheel?


Okay, it's more than 5 lines, but a good library (the "toolbox" in my case) can do all the heavy lifting which all the STL and BOOST is.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "toolbox.h"

int main( void )
{
int x_sub;
char wrkbuf[BUFSIZ];
LIST_T list = { NULL, 10 };
char sentence[] = "This program will reverse these words";

while (gettoken( wrkbuf, sentence, " " ) )
add_list_item( &list, dupstr( wrkbuf ) );

for ( x_sub = list.item_count - 1; x_sub > -1; x_sub-- )
printf("%s ", get_item( &list, ( char *), x_sub ) );

puts("");
return EXIT_SUCCESS;
}

Regards,
Stan Milam.

Great Stan.
Problem is, another system, doesn't use 'gettoken", and 'add_list_item' but

GetToken(sentence,wrkbuf," "); // Inversed arguments
addTolist(dupstr(wrkbuf),&list); // Inversed arguments

and slightly slighty different semantics.

Those do exactly THE SAME work as yours, but both systems are
INCOMPATIBLE!

You see the problem?

The discussion is NOT about the difficulty of writing those
functions, but keeping a common INTERFACE so that all similar
libraries are COMPATIBLE!



--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
.



Relevant Pages

  • Re: STL alternatives?
    ... > I am looking for any free libraries which provide a wrapper around or are an ... I am familiar with Boost and STLSoft. ... > Specifically I am most interested in libraries which have the functionality ... > of the STL but are easier to learn for beginners. ...
    (comp.lang.cpp)
  • C++ MPI Library under review at boost.org
    ... The Boost group is currently reviewing a submission for a C++ ... Dicussions concerning the review are held on ... We emphasize libraries that work well with the C++ Standard Library. ...
    (comp.parallel.mpi)
  • Re: STL.NET news
    ... | the importance of this because you don't understand the STL (once you've ... STL (and other template based libraries), I'm not an expert, but I know ... I'm saying managed types ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Using C++ and ctypes together: a vast conspiracy? ;)
    ... Boost.Python + pygccxml achieve? ... We're not yet sold on using SWIG to wrap our C++ libraries and so we're exploring alternatives. ... The arguments I recall reading that swayed me to try SWIG before Boost were -- ...
    (comp.lang.python)
  • Re: (Boost) Lisp
    ... so now i'd think twice before using some Boost feature somewhere.. ... s> and the Boost Python library seems to have really helped putting Python ... so, if i were you, i'd learn about existing FFI libraries. ...
    (comp.lang.lisp)