Skip to content

Why is nanoprintf organized as a single header? #262

Answered by charlesnicholson
AJ528 asked this question in Q&A
Discussion options

You must be logged in to vote

There's a good write-up about the single-header approach here: https://github.com/nothings/stb?tab=readme-ov-file#why-single-file-headers

The tl;dr is that with a single header file, there's no required build-system lingua franca, and if you want to, you can statically sandbox the nanoprintf implementation inside of a single .c file of your own, with all of the npf_ symbols staying completely private. I don't think the approach makes sense for larger projects, but being able to just grab and check in a single header file into your repo is pretty convenient!

If you do like it split up into two separate files, go for it! I left a comment in the code around line 56, that's where you'd make t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AJ528
Comment options

Answer selected by charlesnicholson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants