Comment by einpoklum

1 day ago

> Honestly, if you're shying away from customising an 1-2kloc piece of code, you probably shouldn't be using a custom printf().

Well, it was good enough for the arduino SDK to adopt: https://github.com/embeddedartistry/arduino-printf

> * function pointers are either costly or even plain unsupported on GPU architectures.*

When you printf() from a GPU kernel, your performance is shot anyway, so performance is not a consideration. And - function pointers work, as long as they all get resolved before runtime, and you don't try to cross CPU <-> GPU boundaries.

> > Honestly, if you're shying away from customising an 1-2kloc piece of code, you probably shouldn't be using a custom printf().

> Well, it was good enough for the arduino SDK to adopt: https://github.com/embeddedartistry/arduino-printf

Well, they didn't shy away from customizing it quite a bit ;)

To be clear I was trying to say it doesn't make too much sense to try to package this as an independent "easy to use" "library" with a handful of build options. Not that it's somehow not "good enough".

Put another way: a situation where you need/want a custom printf is probably a situation where a package like this doesn't exactly help you anyway and you'll need to muck with it regardless. But the code can be used. Which is exactly what the repo you linked did.