This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gettext markup of library sources


>Also, using __ prefexes in macro parameters is completely unnecessary.
>Those tokens are not in the normal namespace and therefore aren't
>polluting it.

It would be nice to use the standard _N. However, this document
indicates that _N usage has problems on Solaris:

http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/BADNAMES

I'm not quite sure how reliable any of these bad, bad, bad names are in
this day and age. Perhaps somebody should review it, and confirm it is
still relevant before libstdc++ departs from standard usage. I believe
we all agree that that should only be done if absolutely necessary.

>> @@ -466,7 +466,7 @@
>>        // localized to this single should-never-get-this-far function.
>>        _WordT&
>>        _M_getword(size_t) const
>> -      { __throw_out_of_range("bitset -- zero-length"); return *new _WordT; }
>> +      { __throw_out_of_range(_("bitset is zero-length")); return *new _WordT; }
>
>Is this really what you want?  Do you want to throw the translated
>string?  This seems wasteful.  It means every instantiation has a call
>to gettext which adds to the code size.

Ok...

>If there is a central place where the strings are used (in the terminate
>handler?) put the gettext call in there and use __N in the throw calls.
> If the user is also supposed to get translated strings provide an
>interface in libstdc++ (or libsupc++) which takes the string and simply
>calls dgettext() (note: *NOT* gettext(), a mistake made by several
>library implementors before).

Good idea.

The terminate handler can be changed, so it's not a good place to
enforce translation. 

However, these __throw_* functions are just wrappers, so that
-fno-exceptions can be used.  See src/functexcept.cc. That might be a
better place to put this translation machinery, since we know that all
exceptions go through this choke point already...

  void
  __throw_length_error(const char* __s)
  { throw length_error(__s); }

can be

  void
  __throw_length_error(const char* __s)
  { throw length_error(_(__s)); }

I believe this will solve objections voiced by both you and Gaby, huh?

Note, that I still think that standardizing on the what() messages is
a great, and separate, idea. It seems everybody agrees on this.

-benjamin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]