netch80: (bird)
[personal profile] netch80
В питоне:

print '|%10%|' % ()
print '|%-10%|' % ()


выводит:

|         %|
|%         |


То же самое в перле и FreeBSD libc.

Но glibc выводит простой процент без расширения поля (две строки с |%|), gcc ругается, что формат неправильный, причём он в принципе не опознаёт такую возможность:

t.c:5: warning: conversion lacks type at end of format
t.c:5: warning: unknown conversion type character '|' in format
t.c:6: warning: conversion lacks type at end of format
t.c:6: warning: unknown conversion type character '|' in format


а C99 и Posix хором говорят "The complete conversion specification shall be %% ."

Date: 2014-07-12 09:51 am (UTC)
From: [identity profile] d1f.livejournal.com
Нет, неочевиден.
Удваивания второго процента нет.
Символа типа преобразования нет, не помню, можно ли так.

Date: 2014-07-12 11:22 am (UTC)
From: [identity profile] netch80.livejournal.com
Второй '%' это и есть символ преобразования:)

Date: 2014-07-12 12:13 pm (UTC)
From: [identity profile] d1f.livejournal.com
Ну, значит, нет такого в glibc.

Profile

netch80: (Default)
netch80

September 2025

S M T W T F S
 123456
78910111213
1415 1617 181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 2nd, 2026 03:55 am
Powered by Dreamwidth Studios