[vox-tech] strerror deprecated?

Bill Kendrick nbs at sonic.net
Tue Dec 26 18:25:57 PST 2006


On Tue, Dec 26, 2006 at 03:55:34PM -0800, Richard Harke wrote:
> Just pragmatically, I'm afraid. I was going to suggest a short test program
> that ran through the error no's but that just covers english, and if you're 
> really determined, a small number of other languages. I expect that
> most languages will use short standard phrases but I have seen a few
> pathological translations (not from the computer field) that were wildly 
> different in length. Maybe Bill Kendrick could comment as his Tuxpaint
> is supported for a large number of languages.

Well, certainly supporting up to 4x the bytes would be necessary in
some cases (I allow strings to be encoded UTF-8, so each output character
may be between 1 and 4 bytes long).

Of course, I'm simply wrapping 'gettext()' calls around the strings,
and using the results in my own functions, e.g.:

  draw_tux_text(TUX_WAIT, gettext("Please wait..."), 1);

I don't need to worry about creating or destroying string buffers to hold
these... as gettext()'s man page says:

  "The resulting string is statically allocated and must not be
  modified or freed."


I DO need to worry about string buffers when doing any kind of manipulation,
just as I would with any other string... translated or not.
(e.g., if I want to strcat(), I need to malloc() the appropriate length to
hold all of the strings I'm concatenating)


-- 
-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/


More information about the vox-tech mailing list