From: Rudolf Polzer Date: 2003-04-18T21:33:23+09:00 Subject: Re: Possible bug? Scripsit ille aut illa �U.Nakamura� : > In message "Re: Possible bug?" > on Apr.18,2003 16:37:58, wrote: > | > | vsnprintf() and snprintf() are used many times. And they are > | > | not provided by MSVCRT directly but defiend in win32/win32.h. > | > | I'd propose to define them in win32/win32.c instead. > | > > | > Is this problem only on win32 platforms? > | > I suspect that this is not right. > | > | Other platforms which don't have them use missing/vsnprintf.c > | instead. Win32 platforms use _vsnprintf()/_snprintf(), but > | they are not vsnprintf()/snprintf() themselves. > > (1) Some platforms have the correct (set null at the end of buffer) > (v)snprintf. It's OK. > (2) Some platforms don't have (v)snprintf. Ruby uses missing/vsnprintf.c. > It's OK. > (3) Win32 platforms have _(v)snprintf, and they are broken. > Your patch totally fix the problem, I agree. > (4) I doubt some other platforms exist. The platforms have the wrong > (v)snprintf just like win32's _(v)snprintf. > > If (4) is right, we should fix all (v)snprintf call at all. > I am anxious about it, and this is that I want to say previous mail. Can't one easily check in a configure script for that? /* conftest.c */ #include int main() { char out = 2; snprintf(&out, 1, "\001"); return out; } possible outcomes: - cannot compile/link: no snprintf; - compile confgtest.c with -Dsnprintf=_snprintf - cannot compile/link: use missing/ - 0: #define rb_snprintf _snprintf - 1: #define rb_snprintf_to_fix _snprintf #define rb_snprintf rb_fixed_w32_snprintf - otherwise: use missing/ - 0: #define rb_snprintf snprintf - 1: #define rb_snprintf_to_fix snprintf #define rb_snprintf rb_fixed_w32_snprintf - otherwise: use missing/ Shouldn't that fix the problem in any case? -- Desweiteren fiel mir auf, das die Kommandozeile immer statt '?' ein Fragezeichen generierte. [Da_David in t-online.homepage.technik; OE hat mal wieder versagt]