I’m going mad. Is there a way to do x-platform debug printing of String ? On one hand, in Windows I must use %s and (const juce_wchar*) cast, whilst on Mac I must use %S for the same thing. Any suggestions?
Edit: If I for JUCE_WIN32 change CharacterFunctions::vprintf to have the same implementation as for MACOS_10_3_OR_EARLIER, it works fine. That is %s is associated with single-byte character strings and %S is associated with wide-char strings.
Question: Will this break anything? If not, I’d suggest the change for juce.
Hmm - I’m surprised that the mac version would work properly on win32, because it’s casting a wchar* to a char*, and using it as the format string. Not sure about this really…
Ah, but the char* cast of dest is just used internally to render the buffer via vprintf, then it is converted back to juce_wchar*. And formatTemp is converted to const char* correctly by the String class. That’s why it works…
It’s a PDF about a typesafe based Printf implementation.
I can send you the PDF if you want.
Note that GCC automatically checks printf(…) va args, but it’s not required in standard.
VS up to 2k5 doesn’t. Oh, and printf is deprecated, you have to use “Whatsthat” secure_printf instead.