LINUX.ORG.RU

Что такое null wide character?

 


0

1

man mblen:

If s is not a NULL pointer, the mblen() function inspects at most n bytes of the multibyte string starting at s and extracts the next complete multibyte character. It uses a static anonymous shift state known only to the mblen() function. If the multibyte character is not the null wide character, it returns the number of bytes that were consumed from s. If the multibyte character is the null wide character, it returns 0.
И т.д.

Не пойму никак, что такое null wide character?

★★★

Ответ на: комментарий от normann

Им может заканчиваться строка, как в случае с ASCIIZ.

slovazap ★★★★★
()

Юникодная руна, не имеющая ширины. Например, \u0301. К \0 касания не имеет.

anonymous
()
Ответ на: комментарий от normann

L'\0' там не будет, но будет мультибайтный эквивалент ('\0'). Просто mblen же работает с широкими символами, вот и его поведение определено в таких же терминах.

Не знаю, что там аноним имеет в виду, вот документация, которая согласна со мной (четвёртый абзац).

xaizek ★★★★★
()

что такое null wide character?

Ты читаешь как «null-wide character», а авторы имели в виду «null wide-character». То есть не «символ, длина которого null», а «широкий символ, который воплощает собой null-символ». Аналог однобайтного '\0', только широкий.

i-rinat ★★★★★
()
Ответ на: комментарий от xaizek

вот документация

Ценная ссылочка, благодарен.

normann ★★★
() автор топика
Ответ на: комментарий от anonymous

Юникодная руна, не имеющая ширины.

Это бы называлось zero-width character.

anonymous
()

Странный man mblen. Вот из стандарта:

If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte character encodings, respectively, do or do not have state-dependent encodings. If s is not a null pointer, the mblen function either returns 0 (if s points to the null character), or returns the number of bytes that are contained in the multibyte character (if the next n or fewer bytes form a valid multibyte character), or returns −1 (if they do not form a valid multibyte character).

anonymous
()
Ответ на: комментарий от xaizek

Просто mblen же работает с широкими символами

А по названию и не скажешь.

anonymous
()
Ответ на: комментарий от anonymous

Видимо, по сети прилетел.

$ man mbrtowc | grep -A1 -B1 null\ wide
       It updates the shift state *ps.  If the converted wide character is not
       L'\0' (the null wide character), it returns the number  of  bytes  that
       were  consumed  from  s.   If the converted wide character is L'\0', it
i-rinat ★★★★★
()
Последнее исправление: i-rinat (всего исправлений: 1)
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.