[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: static i18() strings
From:       Jacek Stolarczyk <jacek () mer ! chemia ! polsl ! gliwice ! pl>
Date:       1999-06-16 13:14:16
[Download RAW message or body]

On Wed, 16 Jun 1999, Espen Sand wrote:

> Hmm, this is a static array of pointer to char. I don't think I will
> get an overrun here. I could have written:
> 
> const QString &hexError( int index )
> {
>   static const char *messages[] = 
>   {
>      i18n("No data"), 
>      i18n("Another string that is loger than 20"),
>       ....
>   }
> };
Obviously, I missed that *. Sorry for creating confusion.
 
> or is i18n() doing something I haven't quite 
> understood? How does it work anyway? If the default
> string is simply replaced in memory by another language
> string, then the above example is obviously useless!
> 
Well, if i18n() returned you a const char* then you would have to free the
allocated memory yourself, but, as Staphan said, it returns QString so it
should take care of itself.

Regards,

Jacek Stolarczyk
--
jstolarz on cvs.kde.org
Coordinator of Polish translations of KDE

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic