Code review for new library

Nicholas Drozd nicholasdrozd at gmail.com
Thu Apr 29 21:55:26 UTC 2021


This is a very shallow review, but I couldn't get the tests to run.

  make tests
  c99 -Iinclude -DNDEBUG -O1  -o build/release/test/t_vector
build/release/vector.o test/t_vector.c
  /usr/bin/ld: cannot open output file build/release/test/t_vector: No
such file or directory
  collect2: error: ld returned 1 exit status
  make: *** [Makefile:26: build/release/test/t_vector] Error 1

That's after running `make`.

On Sun, Apr 25, 2021 at 6:08 PM Joe Nelson <joe at begriffs.com> wrote:
>
> Hey all, can I get a code review on my new project?
> https://github.com/begriffs/libderp
>
> Backstory: I was working on some parser examples, and for one of the
> programs I needed an associative map. I got mad that there wasn't a
> library for this that worked to my liking. So I took a detour to make
> (yet another) C collection library, but one that's easy to build and
> avoids tricky macro magic or "invasive" data structure changes.
>
> I haven't added any documentation yet, but thought I'd check how people
> like the interface first. I tried to get inspiration from these
> libraries, and find commonality:
>
> * C++ STL https://www.cplusplus.com/reference/stl/
> * Ada 2012 containers https://www.adaic.org/resources/add_content/standards/12rm/html/RM-TOC.html
> * Smalltalk collection protocols https://wiki.squeak.org/squeak/uploads/172/standard_v1_9-indexed.pdf
> * .NET https://docs.microsoft.com/en-us/dotnet/standard/collections/#choose-a-collection
> * java.util https://docs.oracle.com/javase/7/docs/api/java/util/package-frame.html
>
> Also consulted the Standard ML basis library, the Haskell 2010 language
> report, and Common Lisp HyperSpec. However those functional libraries
> didn't really apply.
>
> So far I've implemented vector (dynamic array), list (doubly linked),
> and hashmap.
>
> Ways you can help:
> * Is the current interface missing functions that you'd find useful?
>   Going to add a iterator for the hashmap, for one thing...
> * Are the names meaningful to you? Feel free to bikeshed.
> * See any bugs? Or even have a hunch of things I should test?
> * Can we simplify the Makefile in a totally portable way? It's very
>   repetitive.
> * The algorithms aren't fancy, but do you see obvious improvements?
>   For instance, my mergesort is recursive and could theoretically
>   hit stack limitations. Things along those lines.
> * Does the project build on your system?
> * Should the function names have a common prefix?
>
> My plan is to rewrite the tests more methodically, using code coverage
> to guide me in coming up with scenarios. Then write a man page for each
> function. Then have it compile a .a and .so library. Finally add
> versioning and pkg-config information, and package it up for a bunch of
> OSes.
>
> Thanks for your help!


More information about the Friends mailing list