I need to do some string formatting for debugging purposes on a platform with no OS libraries, no C/C++ standard libraries (well, sort of, it's complicated) and no runtime for another language.

Now, I know that that there are quite a few out-of-libc implementations of printf/sprintf/snprintf, but some are very partial; some have quirks or bugs; some actually do depend on standard library code (say, itoa); etc.

I would like to be able to compare the strengths and weaknesses of these in order to choose one.


  • Libre license
  • Gratis
  • Covers most printf() formatting %-codes


  • Doesn't have to be strictly C, can be C++
  • Doesn't have to be independent of all C library headers (as opposed to code), but must be frugal about this so I might be able to lift stuff from the header files as necessary


  • Covers all of the standard printf() formatting %-codes
  • License more permissive than GPL
  • Non-convoluted code
  • snprintf() rather than sprintf()
  • vsnprintf() in addition to snprintf()
  • 1
    You will be coding and debugging for years to implement a 'clean' set of the *print*() functions. (and it will be huge) You did not mention WHY you could not use a stand alone libc. I would strongly suggest downloading such a 'standalone' library and linking that into your application – user3629249 May 22 '17 at 21:30
  • 1
    @user3629249: I don't intend to code this myself, I'm looking for a recommendation for something pre-existing. To answer your question - no such libc is available, nor can it be; much of the functionality is not physically supported - I'm writing code for a GPU. I didn't mention that in the actual question since I thought I'd make it a bit more general. – einpoklum May 22 '17 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.