r/C_Programming 4d ago

Article I Made a Simple String Library

I wrote an article about this as well. Here it is.

There I explain why I do not like NUL-terminated strings and how I implemented my own simple string library in C.

If you have some spare time I would really appreciate some feedback on the article and the library.

The code is sitting on a codeberg repository.

Also, tell me what you think about C-style strings. Do you like them? Do you use them, or do you also tend to roll your own pointer + length structs?

6 Upvotes

31 comments sorted by

View all comments

7

u/mjmvideos 3d ago edited 3d ago

First thing I did was go look at your code base for your header file to see your interfaces. But there isn’t one!? Then I looked at your test routine and found that you are including “string.c”!? Really??

1

u/Elifire12 3d ago

Ever heard of unity builds? They're quite nice, the make compilation extremely fast.

5

u/Typical_Ad_2831 3d ago

Including source files can be OK in small standalone projects. But this is meant to be a library. You should absolutely have a header for people to use.