Code review for new library

Martin VanWinkle martin.vanwinkle at gmail.com
Fri Apr 30 21:22:16 UTC 2021


Joe,

Here are the templates that I use for autotools style projects.  Man and
info pages are under doc, pkgconfig stuff is under lib.  Nothing has been
reviewed by somebody who has more experience than me, so I'm not sure if
I'm doing anything wrong.  For example, I'm pretty sure I should be using
the TESTS thing that autotools has, instead of always compiling the program
to test the library.

https://github.com/mvanwinkleias/mv_c_package_template_test/tree/master/src/templates/c_library_template2

Instructions for building debian packages are in ExtraMakefile.  I don't
have spec file generation done (yet).

The templates can be filled out by this project:

* https://github.com/theias/ias_package_shell
By specifying the project Template dir and control file like this
--project-template-dir ...
--project-control-file ...
(They're in src/templates)
(Or, you can edit the templates by hand, or I can generate them for you)

It's been a long time since I've done anything serious with C, but I'll
definitely give your code a read through.

Marty

On Sun, Apr 25, 2021, 19:08 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!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://talk.begriffs.com/pipermail/friends/attachments/20210430/e55658ce/attachment.html>


More information about the Friends mailing list