February 2026

S M T W T F S
1234567
891011121314
15161718192021
22232425262728

Style Credit

Expand Cut Tags

No cut tags
Friday, December 14th, 2007 04:59 pm

Дано: функция glibc, у которой в мануале написано:
    char* nl_langinfo(nl_item item);
If  no  locale has been selected for the appropriate category, nl_lang-
info() returns a pointer to the corresponding string in the "C" locale.

If item is not valid, a pointer to an empty string is returned.

На самом деле:

nl_langinfo doesn't return always char pointers.
For some values it returns unsigned int and for others uint32_t, it really
depends on the value. Say for _NL_TIME_WEEK_1STDAY you want:
union { char *p; unsigned int val; } u;
u.p = nl_langinfo (_NL_TIME_WEEK_1STDAY);
value = u.val;

Разумеется, никакой документации для этого любопыного факта в обозримой вселенной не существует, уж во всяком случае - не на сайте GNU.
Внимание, риторический вопрос: что курят эти люди и зачем они прилетели к нам на Землю?

Originally posted on sm.vox.com

Reply

This account has disabled anonymous posting.
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting