ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] А я тут багу в printf(3) нашел :-) (take two)
@ 2003-07-15  9:54 Alexey Morozov
  2003-07-15 13:43 ` Alexey Starinsky
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Morozov @ 2003-07-15  9:54 UTC (permalink / raw)
  To: community

Выдержка из 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$' не 
задокументирован вовсе)
-- 
С уважением,
Алексей Морозов



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-15 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-15  9:54 [Comm] А я тут багу в printf(3) нашел :-) (take two) Alexey Morozov
2003-07-15 13:43 ` Alexey Starinsky

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git