From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Alexey Morozov To: community@altlinux.ru Date: Tue, 15 Jul 2003 16:54:35 +0700 User-Agent: KMail/1.5.2 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200307151639.37828.alex@hop-go.com> Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit Subject: [Comm] =?koi8-r?b?4SDRINTV1CDCwcfVINc=?= printf(3) =?koi8-r?b?zsHbxcw=?= :-) (take two) X-BeenThere: community@altlinux.ru X-Mailman-Version: 2.1.2 Precedence: list Reply-To: community@altlinux.ru List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2003 09:54:29 -0000 Archived-At: List-Archive: List-Post: Выдержка из man 3 printf (секция the field width): Instead of a decimal digit string one may write `*' or `*m$' (for some decimal integer m) to specify that the field width is given in the next argument, or in the m-th argument, respectively, which must be of type int. Внимание, вопрос: что согласно этой доке напишет printf("%0*d %d %d %d\n", 2, 4, 8, 16); printf("%0*1$d %d %d %d\n", 2, 4, 8, 16); printf("%0*2$d %d %d %d\n", 2, 4, 8, 16); ? Полученный мной результат меня несколько удивил (в первую очередь, своей нелогичностью). Что самое смешное, этот результат совпадает на Linux (glibc-2.2.6), FreeBSD (4.8-STABLE) и MS Windows 2000 (MS VC++ 6). Я так понимаю, пора заполнять lawsuit "SCO против всех", в котором говорить, что printf украден, потому что совместим по багам :-). P.S. Но в MSDN, по крайней мере, дока про '*' соответствует истине ('*m$' не задокументирован вовсе) -- С уважением, Алексей Морозов