Francois Ingelrest wrote:
> On Wed, Apr 9, 2008 at 5:30 PM, Bram Moolenaar <[EMAIL PROTECTED]> wrote: > > Easy to reproduce. Turns out that this line causes it: > > > > sprintf(tmp, format, f); > > > > Here "format" is "%f" and "f" is your value 1e+308. The result is an > > awful long string of numbers. I suppose it's about 308 digits. How big > > does "tmp" need to be to hold any result here? I don't think %f has a > > way of specifying a maximal field width. > > You could use snprintf() to specify the maximum length of tmp. Unfortunately, snprintf() is not available everywhere, and the implementations are not always working in a portable way. The code actually is inside vim_snprintf(), which is the Vim implementation of snprintf(). But it still uses sprintf() to do the difficult work. I guess that 1e308 is about the largest number supported by "double". At least for me 1e309 results in "infinity". Would it be safe enough to use a buffer of about 350 chars? Or are there platforms where "double" can be much bigger? -- hundred-and-one symptoms of being an internet addict: 271. You collect hilarious signatures from all 250 mailing lists you are subscribed to. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---