[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Locale-related questions



Hi,

Nicolas George wrote:
> void put_utf32be(FILE *f, unsigned c)
>   ...
> Note: I hereby place this code under the terms of the GNU GPL.

Are you sure this function qualifies for copyright at all ? ~:o)


To be nitpicking ...

The man page of putc(3) looks suspicious:
       fputc() writes the character c, cast to an unsigned char, to stream.
       ...
       putc() is equivalent to fputc() except that it may be implemented as
       a macro which evaluates stream more than once.

sizeof(unsigned char) is not guarateed to be 1.
(Although it would break lots of software if not.)

So probably one should allocate an array of uint8_t, fill it
by shifted snippets of the integer, and write it by fwrite(3)
or write(2).


Have a nice day :)

Thomas


Reply to: