Hacker GitHub

← All repos

antirez/sds

View on GitHub ↗ ★ 5,588 C

Simple Dynamic Strings library for C

67 mentions on Hacker News by 50 people: 7 stories, 60 comments · first 2014-02-06 · latest 2026-10-15

Mentions per year 67 mentions · busiest year 2021 (13)
20082026
  1. libsds - Simple Dynamic Strings https://github.com/antirez/sds
    comment by Kevin_Flynn · 2026-10-15 · in Why C Strings Suck and How I Fixed Them
  2. Hacker News seems not to hate antirez's sds https://github.com/antirez/sds https://news.ycombinator.com/item?id=45014911
    comment by krapp · 2026-02-08 · in I write games in C (yes, C) (2016)
  3. …consider a must-have in any modern project. Also probably something similar for C, like using SDS ( https://github.com/antirez/sds ) instead of standard library calls. Other than that, great work.
  4. Since I am feeling generous, here are two examples, https://docs.gtk.org/glib/ https://github.com/antirez/sds
    comment by pjmlp · 2026-01-06 · in C Is Best (2025)
  5. ▲ 111
    SDS: Simple Dynamic Strings library for C
    story by klaussilveira · 2025-08-25 · 47 comments
  6. …to add in the header would be a strlen The length is already in the header from what I can tell: https://github.com/antirez/sds/blob/master/sds.h#L64 But my point was that if something like your "free count" byte existed at the end, I…
  7. You might be interested in https://github.com/antirez/sds
  8. ▲ 3
    Sds vs. GB: C string libs, copy or coincidence?
    story by nephewtom · 2025-05-05 · 4 comments
  9. …are quite a few of these "better C string" idioms floating around. Another one to consider is e.g. https://github.com/antirez/sds (used by Redis), which instead stores the string contents in-line with the metadata.
    comment by simscitizen · 2024-12-17 · in Fixing C Strings
  10. …Str: https://cii.s3.amazonaws.com/book/pdf/quickref.pdf [2] ICU - https://icu.unicode.org [3] SDS - https://github.com/antirez/sds [4] GLib - https://docs.gtk.org/glib/struct.String.html
    comment by jll29 · 2024-07-30 · in C Macro Reflection in Zig
  11. …for C; sometimes I feel everyone has gone and invented their own. Antirezs sds is just one example https://github.com/antirez/sds
    comment by zokier · 2024-07-15 · in I'm not a fan of strlcpy(3)
  12. Is [b] https://github.com/antirez/sds ?
    comment by nesarkvechnep · 2024-05-27 · in The CompCert C Compiler
  13. …including interoperability with null-terminated C strings. Like this one used in Redis: https://github.com/antirez/sds And on top of everything else, it's quite ergonomic, so it seems silly to not consider it. This entire line of thinking…
  14. …exist, without vocabulary types on the stardard library adoption will never take off. [0] - https://github.com/antirez/sds [1] - https://en.wikipedia.org/wiki/Abstract_data_type
  15. The creator of this library (antirez) is a regular here on hn. I believe this is used by Redis. https://github.com/antirez/sds
  16. > With the woes of string.h being known, why not just use an alternative like https://github.com/antirez/sds ? That library really doesn't address any of the Unicode issues.
    comment by kerkeslager · 2023-04-06 · in C Strings and my slow descent to madness
  17. With the woes of string.h being known, why not just use an alternative like https://github.com/antirez/sds ? I’ve also been having a blast with C because writing C feels like being a god! But the biggest thing that I like about C is that…
  18. …I get the chance. Thanks to the someone who recommended it on HN some years ago. It's a joy to use. https://github.com/antirez/sds The trick is the size is hidden before the adress of the buffer.("Learn this one simple trick that will…
    comment by cassepipe · 2022-12-03 · in Show HN: A nice C string API
  19. https://github.com/antirez/sds
    comment by rabf · 2022-08-27 · in Ushering out strlcpy()
  20. …something like SDS[0] as part of the standard library, but that is clearly asking too much. [0] - https://github.com/antirez/sds
  21. have you looked into sds: https://github.com/antirez/sds/
    comment by latenightcoding · 2022-03-08 · in Buffet – An All-inclusive Buffer for C
  22. Yes, SDS from Redis project. https://github.com/antirez/sds However the moment you call into other C libraries, they naturally only expect a char *.
  23. …such as sds. But really the point was more to "this should have really been addressed decades ago." https://github.com/antirez/sds
  24. …if I really must write C, then a string handling library like the SDS from Redis project is a must. https://github.com/antirez/sds Naturally turning on all security features of the C compiler being used, warnings, warnings as errors,…
  25. …string-handling libraries in C that avoid those problems (e.g., http://bstring.sourceforge.net/ or https://github.com/antirez/sds ). But the fact remains that the kernel has its own implementations of strcat and sprintf nonetheless (in the…
    comment by geofft · 2021-07-06 · in Linux Rust Support
  26. ▲ 3
    Simple Dynamic Strings library for C
    story by scapbi · 2021-06-22 · 0 comments
  27. You might look at SDS. https://github.com/antirez/sds
    comment by macintux · 2021-06-19 · in Designing a better strcpy
  28. You should also have a look the simple yet efficient sds : https://github.com/antirez/sds
  29. …you would also expect that by now something like SDS would be part of the standard as well. https://github.com/antirez/sds
    comment by pjmlp · 2021-05-08 · in The Byte Order Fiasco
  30. You may find some inspiration for improvements from this project: https://github.com/antirez/sds
  31. …my invention ! Alas it was at least used in Microsoft' BSTR and later by the famous antirez/sds ( https://github.com/antirez/sds ) > no nested macros I hear you. I thought it made them more readable. > is all that's going on I also (maybe…
  32. Strings have nothing to do with objects. You can write a string library, eg. [sds]( https://github.com/antirez/sds ). It's just not standard.
    comment by c-cube · 2021-03-04 · in Git's list of banned C functions
  33. …(MITish) * https://github.com/mpedrero/safeString (MIT licensed) * https://github.com/antirez/sds (BSD 2-clause, and gives you dynamic strings) * https://github.com/maxim2266/str (BSD 3-clause) * https://github.com/xyproto/eg
    comment by cestith · 2021-03-04 · in Git's list of banned C functions
  34. I'm partial to https://github.com/antirez/sds these days
    comment by swlkr · 2021-03-04 · in Git's list of banned C functions
  35. …sds that store the length information in various ways, which solves at least this kind of problem. https://github.com/antirez/sds
  36. …be a pity not to mention here the Simple Dynamic String (SDS) library made by the maker of Redis : https://github.com/antirez/sds It is also very well documented. And all you need to embed it in your project is : sds.c sds.h sdsalloc.h The…
  37. …that care about security in C, even those functions are not the way to go, rather something like https://github.com/antirez/sds . This is something that the book fails to teach, as it also has no mentions of modern static analysers…
    comment by pjmlp · 2020-09-04 · in Modern C
  38. …of the same features (not all), and is kept updated since it's used by redis and other projects. https://github.com/antirez/sds/blob/master/README.md Vstr appears to have last been updated in 2006. It does have a comparison of different…
  39. https://github.com/antirez/sds is heaps better than just using raw strings. Any language with a fat pointer variant out of the box is going to do it better than C as well. That's not to say that the rest of C is bad, but there's nothing to…
    comment by 59nadir · 2019-12-26 · in I love coding in C
  40. ▲ 107
    Simple Dynamic Strings library for C, compatible with null-terminated strings
    story by goranmoomin · 2019-12-03 · 83 comments
  41. …Obviously you can misuse anything, but SDS is easy to use correctly. It's robust enough for Redis. https://github.com/antirez/sds
    comment by tlb · 2019-09-21 · in Why I Write Games in C (yes, C)
  42. …and it was not prohibitively difficult. Something like this probably covers most use cases: https://github.com/antirez/sds
    comment by Steven_Vellon · 2019-09-12 · in Efficient string copying and concatenation in C
  43. sds (simple dynamic strings) is a decent compromise: https://github.com/antirez/sds (used in redis)
  44. sds comes to mind, but there are like gazillion different implementations of the same concept. https://github.com/antirez/sds
  45. …have succeeded, obviously. There are a number of alternative string libraries, though; here's one: https://github.com/antirez/sds . And I'm sure some programmers would suggest C++ as the real "effort to add real string types and maybe…
    comment by saagarjha · 2019-08-26 · in Why is strlen so complex in C?
  46. https://github.com/antirez/sds
  47. Salvatore Sanfilippo, from Redis fame, has a nice one https://github.com/antirez/sds .
  48. Also sds, used by redis: https://github.com/antirez/sds
    comment by tyingq · 2019-04-25 · in Some Were Meant for C (2017) [pdf]
  49. > but you'll be incompatible with any code dealing with native C-strings Not entirely, see https://github.com/antirez/sds Basically, you have a header storing length, etc, but still null terminate, so library functions like strlen are none…
    comment by paavoova · 2018-12-15 · in String tokenization in C
  50. Sds is somewhat nice in that you can work both ways. https://github.com/antirez/sds
    comment by tyingq · 2018-11-03 · in How to implement strings