abalaban wrote:
As such it is automatically converted to std::string upon exit. Note that the std::string constructor copies the buffer, not just point to it, as such it should work.
Well if you are sure that it's automatically converted, I guess it's OK. If it was my code I would use an explicit conversion though and not rely on the compiler to do it for me, but then I don't write much C++ code.
Nonetheless I'm still obligated to use the VARARGS68K macro for all my variadic functions else some integer gets wrongly displayed, it is probably an alignment problem, which is solved by the side-effect of declaring the function as a VARARGS68K
Did you recompile everything after removing VARARGS68K or did you still have some object files compiled with the old VARARGS68K prototype?
BTW this is how I implement my kprintf() in filesysbox.library/NTFS3G/Ext2FS and it is working perfectly there:
Code: Select all
#define GET_SYSBASE (*(struct ExecBase **)4)
#define GET_IEXEC ((struct ExecIFace *)GET_SYSBASE->MainInterface)
APTR debug_mutex;
static char debug_buffer[512];
int kprintf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
int retval = vkprintf(fmt, ap);
va_end(ap);
return retval;
}
int vkprintf(const char *fmt, __VALIST args) {
struct ExecIFace *IExec = GET_IEXEC;
IExec->MutexObtain(debug_mutex);
int retval = vsnprintf(debug_buffer, sizeof(debug_buffer), fmt, args);
IExec->DebugPrintF("%s", debug_buffer);
IExec->MutexRelease(debug_mutex);
return retval;
}
If it didn't write numbers correctly I wouldn't have gotten very far with any of these projects

.