Advice on finding documentation

Apologies, this is not specifically a PIO question. I use Linux->vscode->PIO->espressif32->ESP32

I’m wasting a lot of time because I can rarely find definitive documentation on ESP32 Arduino library functions.
I usually end up looking at the Linux man page or a Posix spec. or just guessing.

Example problem: stdio: Formatting a float, sprintf(b, "Myfloat is %f, myFloat)

Where is the place to find out if sprintf exists at all and exactly which options to “%f” are valid & have been implemented for ESP32?

Thx for any pointers/links.

But sprintf() is not a ESP32 Arduino library function. That’s in the realm of the XTensa GCC compiler / the C library it uses, aka newlib.

I consider a “Arduino library function” as something implemented in core/esp32 or in libraries/.

The Espressif GCC toolchains come from Releases · espressif/crosstool-NG · GitHub. Deep inside there are the configuration files for newlib and the header files for stdio.h, string.h, et cetera. This at least tells you if a function is supposed to exist in accordance to the header file. PlatformIO also allows you to follow a function name to its declaration (Ctrl+Click on identifier).

As far as I know, noone has ever bother to setup a documentation page for “these are exactly the functions that work in our XTensa GCC / newlib configuration”. But you can assume a lot of standard stuff works – sprintf() of course too.

If you really wanna look at the source, I linked the repo for newlib above. sprintf() is in there too, of course.

1 Like

Goodness, that’s straight into my bookmarks. The documentation section is terrific. Easier to understand than the equivalent man page. What is really good is that, if you’re after a particular variant of a function whose source doesn’t include documentation, there’s a note giving the variant that does include it. Love it; no more dtostrf for this boy.

Thank you Max. Very much indeed!