Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

wxString::Printf()

(1/3) > >>

sethjackson:
Hey I have a simple (read probably dumb) question.

Why does alot of the C::B code use wxString::Printf()?

I never use wxString::Printf() in my code. I always use <<. In my opnion it is easier, and better to use <<. So are there any major disadvantages to using <<?

takeshimiya:
Yes, somehow the operator<< didn't worked ok with integers, eventrough the documentation says otherwise.

mandrav:

--- Quote from: sethjackson on June 09, 2006, 02:37:06 am --- So are there any major disadvantages to using <<?

--- End quote ---


--- Quote from: Takeshi Miya on June 09, 2006, 04:48:39 am ---Yes, somehow the operator<< didn't worked ok with integers, eventrough the documentation says otherwise.

--- End quote ---

Exactly. In unicode builds, streaming integers to wxString resulted to nothing  :shock: . I don't know if it has been fixed in the current wx version but we wouldn't go back and change everything now.
Another reason is translations. E.g.:

--- Code: ---1. _("Welcome %s to %s (build %d).");
2. << _("Welcome ") << s << _(" to ") << s2 << _(" (build ") << i << _(").");

--- End code ---
In many languages a word's translation might differ based on context. In the second case, there is no context (each string would be translated separately).
Which is easier for the translators? ;)

sethjackson:

--- Quote from: mandrav on June 09, 2006, 08:42:50 am ---
--- Quote from: sethjackson on June 09, 2006, 02:37:06 am --- So are there any major disadvantages to using <<?

--- End quote ---


--- Quote from: Takeshi Miya on June 09, 2006, 04:48:39 am ---Yes, somehow the operator<< didn't worked ok with integers, eventrough the documentation says otherwise.

--- End quote ---

Exactly. In unicode builds, streaming integers to wxString resulted to nothing  :shock: . I don't know if it has been fixed in the current wx version but we wouldn't go back and change everything now.
Another reason is translations. E.g.:

--- Code: ---1. _("Welcome %s to %s (build %d).");
2. << _("Welcome ") << s << _(" to ") << s2 << _(" (build ") << i << _(").");

--- End code ---
In many languages a word's translation might differ based on context. In the second case, there is no context (each string would be translated separately).
Which is easier for the translators? ;)

--- End quote ---

Actually << works with integers in wx 2.6.3 IIRC (don't take my word for it though I need to check it first).

sethjackson:
I just tested << with integers, and it works just fine with wx 2.6.3. :D

Navigation

[0] Message Index

[#] Next page

Go to full version