A convenient C string API, friendly alongside classic C strings.

This page summarizes the projects mentioned and recommended in the original post on /r/programming

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • SDS

    Simple Dynamic Strings library for C

  • The canonical library for this is SDS. Any new claimant to the C-string throne should explain the advantages/disadvantages/trade-offs of its use in comparison to SDS.

  • str

    C String handling library inspired by Luca Sas (by mickjc750)

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • rapidyaml

    Rapid YAML - a library to parse and emit YAML, and do it fast.

  • The inability, or brittleness, to embed NUL bytes into the string, for once. Zeroed bytes can be valid as an internal bytes of a longer encoded character. And the inefficiency of tempting every caller to rederive the string length on every use, leading to such bugs as quadratic parsing behavior with sscanf. The extra register for an explicit length is a very minute price to pay compared to that.

  • STC

    A modern, user friendly, generic, type-safe and fast C99 container library: String, Vector, Sorted and Unordered Map and Set, Deque, Forward List, Smart Pointers, Bitset and Random numbers. (by stclib)

  • Another one promising “container library”: https://github.com/tylov/STC

  • sbs

    A reformulation of sds (https://github.com/antirez/sds) for buffers

  • The big downside for SDS is all SDS strings are heap allocated and thus need to be memory managed. Most of these struct based libraries are not so that is the main advantage to me. I've been looking at SBS lately.

  • afl

    american fuzzy lop (copy of the source code for easy access) (by mirrorer)

  • You're in for a treat! I used afl, or american fuzzy lop, more specifically the afl++ fork packaged by Debian. The original usage is super simple, and many programs require little or no changes for fuzzing. The program must accept input on standard input or through a file named by a command line argument. When that's the case, compile with afl-gcc, a gcc wrapper which instruments branches, the then run the fuzzer with afl-fuzz.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts