Re: [HACKERS] snprintf causes regression tests to fail
От
Tom Lane
Тема
Re: [HACKERS] snprintf causes regression tests to fail
Дата
Msg-id
2974.1109723315@sss.pgh.pa.us
Ответ на
Re: [HACKERS] snprintf causes regression tests to fail (Nicolai Tufar)
Список
Дерево обсуждения
Re: [HACKERS] snprintf causes regression tests to fail Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] snprintf causes regression tests to fail Nicolai Tufar <ntufar@gmail.com>
Re: [HACKERS] snprintf causes regression tests to fail Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] snprintf causes regression tests to fail Nicolai Tufar <ntufar@gmail.com>
Re: [HACKERS] snprintf causes regression tests to fail Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] snprintf causes regression tests to fail Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] snprintf causes regression tests to fail Joerg Hessdoerfer <Joerg.Hessdoerfer@sea-gmbh.com>
BTW, you should read the official spec for snprintf:
http://www.opengroup.org/onlinepubs/007908799/xsh/fprintf.html
There are a couple of interesting things that the present code is most
certainly not doing correctly, notably:
In format strings containing the %n$ form of conversion
specifications, numbered arguments in the argument list can be
referenced from the format string as many times as required.
Also it seems that runtime precision specs are required to have explicit
numbers when used in a %n$ string, which is something I didn't know
until just now. This example in the spec is instructive:
printf("%1$d:%2$.*3$d:%4$.*3$d\n", hour, min, precision, sec);
It might be a good idea to go look at whichever *BSD we got this code
from originally, and see if they've upgraded it to do %n$. 'Cause it
will take a nontrivial amount of work to get from where we are now to
something that follows the full spec.
regards, tom lane
В списке pgsql-hackers-win32 по дате отправления
От: Joerg Hessdoerfer
Дата: